Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8060589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:02:35+00:00 2026-06-05T10:02:35+00:00

I have an object defined like this: create or replace type MYOBJ as object

  • 0

I have an object defined like this:

create or replace type MYOBJ as object (
    field1 varchar2(100);
    field2 varchar2(100);
    field3 varchar2(100);
);

and a function like this (I know I can use a constructor, whatever):

create or replace function new_myobj ( field1 varchar2 default null
                                     , field2 varchar2 default null
                                     , field3 varchar2 default null) 
                                       return myobj is
v_obj MYOBJ;
begin
    v_obj := myobj(field1, field2, field3);
    return v_obj;
end new_obj;

I’m trying to create an instance of that object type like this

declare
   v_plsql_block varchar2(200);
   v_my_obj MYOBJ;
   v_field varchar2(200);
   v_some_value varchar2(200) := 3;
begin 
    v_field := 'field1'
    v_plsql_block := 'begin :a := new_myobj('||v_field||' => :b); end;';
    execute immediate v_plsql_block using in v_some_value, out v_my_obj;
end;

but I get an error:
PLS-00306: wrong number or types of arguments in call to 'NEW_MYOBJ'

Is it even possible to do what I’m trying to?

FTR in the actual code v_field should be defined dynamically.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:02:37+00:00Added an answer on June 5, 2026 at 10:02 am

    Just replace the order of the params in the using clause:

    execute immediate v_plsql_block using out v_my_obj, in v_some_value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a user defined type: CREATE OR REPLACE TYPE TEST_TYPE AS OBJECT
I have a script which creates a user-defined object like this: obj = new
I want to print out an object of a user-defined type, like this cout
I have a function like this defined in one class: using System; using System.Collections.Generic;
I have defined 4 comparators for my object like this: public static Comparator<mObject> comp0
I have a User table defined like this: CREATE TABLE Users( UserId int IDENTITY(1,1)
In MSSQL I have a table created like this: CREATE TABLE [mytable] (fkid int
I have 4 classes, one Database helper and 3 defined like this: abstract class
I have two objects defined something like this (simplified for sake of the question):
Trying to create an object in Javascript (for Appcelerator/Titanium). The object is defined like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.