Object type with constructor gets PLS-00307 (10g)

Hi all,
I have the following code, and I am getting the following error. I want to have a constructor that can be called without specifying the parameters by name. Is that not possible?
What am I doing wrong?
Thanks!
Error:Error at line 50
ORA-06550: line 5, column 17:
PLS-00307: too many declarations of 'TRANSFEROBJECT_O' match this call
ORA-06550: line 5, column 5:
PL/SQL: Statement ignoredCode:DROP TYPE TransferObject_o
CREATE TYPE
    TransferObject_o
AS OBJECT
    m_objectId  NUMBER(15)
  , m_attribute VARCHAR2(4000)
  , CONSTRUCTOR FUNCTION TransferObject_o
        p_objectId  NUMBER--   := NULL
      , p_attribute VARCHAR2-- := NULL
    ) RETURN SELF AS RESULT
CREATE TYPE BODY
    TransferObject_o
AS
    CONSTRUCTOR FUNCTION TransferObject_o
        p_objectId  NUMBER--   := NULL
      , p_attribute VARCHAR2-- := NULL
    ) RETURN SELF AS RESULT
    IS
    BEGIN
        SELF.m_objectId  := p_objectId;
        SELF.m_attribute := p_attribute;
        RETURN;
    END;
END;
DECLARE
    l_object TransferObject_o;
BEGIN
    l_object := TransferObject_o(1, 'B');
END;
/

Hi,
When you create an OBJECT, Oracle automatically creates a constructor with one argument for each of the object's attributes. You've created a second constructor, that has the same signature, except that the arguments in your functin are optional. When you call an overloaded routine ( whether it's a constructor or any other function or procedure), Oracle has to decide which of the versions you're calling. If you call the TransferObject_o constructor with fewer than two arguments, the system knows you mean the version you wrote, since the default constructor has two required arguments. But when you call the TransferObject_o constructor with exactly two arguments, it has no way of telling which version to use, and raises an error.
The Oracle 10.1 "PL/SQL User's Guide and Reference" says:
"You can define your own constructor methods, either overriding a system-defined constructor, or defining a new function with a different signature."
I couldn't find an example of overriding the constructor (not that I spent a lot of time looking. If you find one, or figure out how to do it, please post an example or a link here.).
Failing that, you can always give your constructor a different signature (e.g., put the VARCHAR2 argument first).

Similar Messages

  • Invalid stored Object Types with Constructor Function

    hi folks,
    i created a stored object type on database 10.2. but it is invalid.
    it has a constructor function and a number of member functions.
    SQLPlus the only feddback is
    Warning: Type Body is compiled with errors.
    Toad 9.0.0 gives no error message.
    how can i find out what kind of error there is? and where?
    thx for help
    joerg

    In SQL*Plus, when you get a warning that you've created an object with compilation errors, you can type
    SQL> show errorsto see the list of errors.
    Justin

  • 8.1.7 jdbc driver: object types with double quotes

    Hi all,
    While switching from 8.1.6 to 8.1.7 I have trouble with the jdbc driver. It doesn't work
    as before: The function CallableStatement.registerOutParameter (and probably some other) doesn't take object type
    names in double quotes anymore. A test program is appended to this message. Using a 8.1.6 jdbc driver this program works fine but with a 8.1.7 jdbc driver it throws an exception.
    My questions are: Is this bug already filed?
    Is a bugfix already available somewhere?
    Thanks in advance for any information
    Joerg
    import java.sql.*;
    * create type "test_t" as object (atrb number(10));
    * create table "test" of "test_t" (atrb not null) oidindex();
    class test
    public static void main (String args [])
    throws SQLException
    String s = "begin insert into \"test\" t values (1)" +
    " returning ref(t) into ?; end;";
    try{
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@host:1521:orcl","joerg", "password");
    CallableStatement cs = conn.prepareCall( s );
    cs.registerOutParameter(1, Types.REF, "\"test_t\"");
    cs.execute();
    System.out.println("Statement returned:");
    System.out.println( cs.getObject(1) );
    cs.close();
    conn.commit();
    conn.close();
    catch(SQLException e){
    System.out.println("SQLException was thrown...");
    System.out.println(e.getMessage());
    }

    I believe that typenames are always treated as case sensitive (unless they are all uppercased).
    In your example you should write:
    cs.registerOutParameter(1, Types.REF, "test_t");
    If you had declared the type test_t in a case insensitive way (without "..."), then you'd have to write:
    cs.registerOutParameter(1, Types.REF, "TEST_T");
    If you have a schema-qualified name, use a ".":
    cs.registerOutParameter(1, Types.REF, "SCOTT.test_t");
    However, this behavior implies that you cannot use "." inside of quoted identifier names.

  • How to use Object types with inheritance in design editor

    Does anyone know how to implement Oracle object sub types in Design editor.
    Is there a way of using the Database design transformer to convert entities to Object types rather than tables?
    Thanks in anticipation
    David

    What database and connection type are you using? Are you connecting the report directly to the database, or trying to assign the datasource to object data?
    It sounds like you might be trying to use a linked list, collection or other C# construct to pass your data in. This currently isn't supported by the Crystal Reports SDK. You can use a DataSet or a DataTable, and possibly also an IDataReader depending on which version of Crystal Reports you're referencing in your project. Of course you can also connect directly to the database, even if the database isn't on the same machine as the application.
    The way to show master records with detail information is through the use of subreports and linked subreport parameters. Linked subreports take their parameter value from a record in the main report, so that only the data appropriate to that master record is displayed. The guys over in the [report design|SAP Crystal Reports; forum can help you out with this if you have questions on the specifics.

  • Asking for return type with constructor

    import java.swing.*;
    public class firstWindow extends JFrame
         public static final int WIDTH = 300;
         public static final int HEIGHT = 200;
         public FirstWindow()
              super();
              setSize(WIDTH,HEIGHT);
              JLabel newLabel = new JLabel("My Medical Record.");
              getContentPane().add(newLabel);
              WindowDestroyer listener = new WindowDestroyer();
              addWindowListener(listener);
    }Continue to get a 'method with no return type'. I looked for a syntax error but can't see it.
    Edited by: Zarnon on Mar 2, 2008 2:07 PM

    radiorx wrote:
    public FirstWindow()Class name is firstWindow, so the constructor should be re-named :
    public firstWindow()In the former case, the FirstWindow identifier creates a method rather than a constructor, and methods in Java need a return type.
    Hope this helpsInstead of renaming the constructor, rename the class file public class firstWindow extends JFrame into public class FirstWindow extends JFrame

  • How to manage non-SAP objects types with SAP Netweaver ?

    I would like to know how it is possible to integrate into the SAP software configuration managment tools (NWDI CTS, CTS+...) non-SAP objects like shell scripts or SQL requests ?
    These shell scripts are, for example:
    - external host scheduler jobs
    - general scripts for start/stop application
    - parameters needed by application at the os level
    My goal should to store into a DEV SAP system these objects, in order to take benefit of SE80 version management. So, it should be possible to create transport order in SE10 and to transport these non-SAP objects in test and production system.
    Thank in advance for your answers.
    Daniel Ouin

    the standard functionality for this up until 4.72 is to call RFCs/BAPIs through a RFC binding library for the third party software, e.g. the language of your choice is PHP then you use the PHP RFC library found [here|http://saprfc.sourceforge.net/], if you have to connect from a .NET environment you might try to get the SAP .NET connector.
    anton
    PS: RTFM and/or using the search facilities here on SCN would help you a lot with your task.

  • Creting  object array  with constructor

    Hello all,
    Here is a query kindly let me know your views.
    Q) I want to create four objects and if i write a constructor how is it invoked..
    kidly help me ...
    thanks in advance
    mahesh

    Hello all,
    Here is a query kindly let me know your views.
    Q) I want to create four objects and if i write a
    constructor how is it invoked..
    kidly help me ...
    thanks in advance
    maheshYour question is very vague, very general, in short, impossible to really answer well. We need more specific information. A golden rule for forum questions: Please put as much effort into writing your question as you would wish someone would use answering your question.
    I look forward to hearing more from you.
    /Pete

  • Oracle Object Type Constructor Called Multiple Times

    I have an object type with a custom constructor. In SQL, when I reference the attributes the constructor is called multiple times in Oracle 11.2.0.4.
    Why is the constructor called multiple times?
    How do I stop it?
    My current work around is to reference the attributes and use the /*+ materialize */ hint.
    Problem Setup
        create or replace type Foo as object
          Bar1 NUMBER,
          Bar2 NUMBER,
          Bar3 NUMBER,
          CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
            RETURN SELF AS RESULT
            DETERMINISTIC
        create or replace type body Foo is
          -- Member procedures and functions
          CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
            RETURN SELF AS RESULT
            DETERMINISTIC
          AS
          BEGIN
            SELF.Bar1 := p_Bar1;
            SELF.Bar2 := p_Bar2;
            SELF.Bar3 := p_Bar3;
            dbms_output.put_line('Foo Constructor Called');
            RETURN;
          END;
        end;
    Problem
        -- Constructor is called 6 times!
        -- Once for each column and once for each predicate in the where clause.
        SELECT x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3, f
        FROM (
          SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
          FROM dual d
        ) x
        WHERE x.f.bar1 = x.f.bar1 AND x.f.bar2 = x.f.bar2
    Output
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Foo Constructor Called
    Workaround
        -- Work Around
        -- Constructor is called 3 times
        -- Once for each column in the inline view.
        -- Note, I removed column f (the object type) because it's not compatible with the materialize hint.
        WITH y AS (
          SELECT /*+ materialize */ x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3
          FROM (
            SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
            FROM dual d
          ) x
        SELECT y.bar1, y.bar2, y.bar3
        FROM y
        WHERE y.bar1 = y.bar1 AND y.bar2 = y.bar2

    Another work-around is described in this thread... Accessing fields of a custom object type... which makes use of a collection type combined with the TABLE operator, like so...
    create or replace type FooTable as table of Foo;
    SELECT x.bar1 AS bar1, x.bar2 AS bar2, x.bar3 AS bar3, value(x) f
        FROM table(FooTable(
          foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3)
        )) x
        WHERE x.bar1 = x.bar1 AND x.bar2 = x.bar2
    BAR1 BAR2 BAR2 F
    1    2    3    (1, 2, 3)
    Foo Constructor Called
    Hope that helps...
    Gerard

  • Type attribute with Object type or Nested table?

    I have been creating lot many threads around the same problem, however i thought i knew but realized I do not know or else do not know how to..
    I have created object type with an attribute READINGVALUE NUMBER(21,6)...How can i use type attribute on this object while declaring variable.....can we use type attribute on NESTED TABLES, similar to the db tables?
    example
    CREATE TYPE READING AS OBJECT(READINGVALUE NUMBER(21,6));
    CREATE TABLE INTERVALREADINGS OF TYPE READING;

    meghavee wrote:
    Thanks Solomon, however this approach does not preserve precision/scale of number data type.....What you can do is create placeholder tables:
    SQL> create table reading_type_placeholder of reading
      2  /
    Table created.
    SQL> desc reading_type_placeholder
    Name                                      Null?    Type
    READINGVALUE                                       NUMBER(21,6)
    SQL> declare
      2      v_var reading_type_placeholder.readingvalue%type;
      3  begin
      4      v_var := 123456789012345;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2      v_var reading_type_placeholder.readingvalue%type;
      3  begin
      4      v_var := 1234567890123456;
      5  end;
      6  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 4
    SQL>And if you modify type attribute:
    SQL> alter type reading modify attribute readingvalue number(26,6) cascade;
    Type altered.
    SQL> desc reading_type_placeholder
    Name                                      Null?    Type
    READINGVALUE                                       NUMBER(26,6)
    SQL>SY.

  • DISTINCT on object type collection not working with GROUP BY

    Hello,
    I have an object type with collection defined as:
    create or replace type individu_ot as object (
       numero_dossier          number(10),
       code_utilisateur        varchar2(8 char),
       nom                     varchar2(25 char),
       prenom                  varchar2(25 char),
       map member function individu_map return number
    create or replace type body individu_ot is
       map member function individu_map return number
       is
       begin
          return SELF.numero_dossier;
       end individu_map;
    end;
    create or replace type individu_ntt is table of individu_ot
    /When I use it in simple SQL without any aggregation, the distinct keyword works well and returns me the distinct entry of my object type in the collection:
    SQL> select cast(collect(distinct individu_ot(indivmc.numero_dossier, indivmc.idul, indivmc.nom, indivmc.prenom)) as individu_ntt) as distinct_list
    from   site_section_cours    sisc
              inner join enseignant_section_mc   ensemc
              on sisc.code_session = ensemc.code_session and
                 sisc.numero_reference_section_cours = ensemc.numero_reference_section_cours
              inner join individu_mc indivmc
              on ensemc.numero_dossier_pidm = indivmc.numero_dossier
    where  sisc.seq_site_cours = 6
    DISTINCT_LIST(NUMERO_DOSSIER,CODE_UTILISATEUR,NOM,PRENOM)                                                                                                                                                                                            
    INDIVIDU_NTT(INDIVIDU_OT(15,PROF5,Amidala,Padmé))                                                                                                                                                                                                    
    1 row selected.However in SQL with broader selection with group by, the distinct isn't working anymore.
    SQL> select *
    from   (
             select sisc.seq_site_cours,
                    cast(collect(distinct individu_ot(indivmc.numero_dossier, indivmc.idul, indivmc.nom, indivmc.prenom)) as individu_ntt) as distinct_list
             from   site_section_cours      sisc
                       inner join enseignant_section_mc   ensemc
                       on sisc.code_session = ensemc.code_session and
                          sisc.numero_reference_section_cours = ensemc.numero_reference_section_cours
                       inner join individu_mc indivmc
                       on ensemc.numero_dossier_pidm = indivmc.numero_dossier
             group by sisc.seq_site_cours
    where seq_site_cours = 6
    SEQ_SITE_COURS DISTINCT_LIST(NUMERO_DOSSIER,CODE_UTILISATEUR,NOM,PRENOM)                                                                                                                                                                                            
                 6 INDIVIDU_NTT(INDIVIDU_OT(15,PROF5,Amidala,Padmé),INDIVIDU_OT(15,PROF5,Amidala,Padmé),INDIVIDU_OT(15,PROF5,Amidala,Padmé),INDIVIDU_OT(15,PROF5,Amidala,Padmé),INDIVIDU_OT(15,PROF5,Amidala,Padmé))                                                    
    1 row selected.there is case where I need to return more than one collections, with distinct entries in it.
    Is there something I am missing?
    Thanks
    Bruno

    Not a bug, rather an undocumented feature.
    Here are some alternatives you might want to test :
    1) Using the SET operator to eliminate duplicates :
    SELECT sisc.seq_site_cours,
           set(
             cast(
               collect(individu_ot(indivmc.numero_dossier, indivmc.idul, indivmc.nom, indivmc.prenom))
               as individu_ntt
           ) as distinct_list
    FROM site_section_cours sisc
         INNER JOIN enseignant_section_mc ensemc
                 ON sisc.code_session = ensemc.code_session
                 AND sisc.numero_reference_section_cours = ensemc.numero_reference_section_cours
         INNER JOIN individu_mc indivmc
                 ON ensemc.numero_dossier_pidm = indivmc.numero_dossier
    GROUP BY sisc.seq_site_cours
    ;2) Using MULTISET with a subquery
    SELECT sisc.seq_site_cours,
           CAST(
             MULTISET(
               SELECT distinct
                      indivmc.numero_dossier, indivmc.idul, indivmc.nom, indivmc.prenom
               FROM enseignant_section_mc ensemc
                    INNER JOIN individu_mc indivmc
                            ON ensemc.numero_dossier_pidm = indivmc.numero_dossier
               WHERE sisc.code_session = ensemc.code_session
               AND sisc.numero_reference_section_cours = ensemc.numero_reference_section_cours
             AS individu_ntt
           ) AS distinct_list
    FROM site_section_cours sisc
    ;

  • SYS_PLSQL  Object type !!  bug!!

    Hi,
    I have got the following object type definition by using USER_TYPES dictionar
    SQL> select dbms_metadata.get_ddl('TYPE', type_name, user) str
    2 from user_types
    3 where
    4 type_name ='SYS_PLSQL_12564004_164_1'
    5
    CREATE OR REPLACE TYPE "test"."SYS_PLSQL_12564004_164_1" as object (
    ER_KEY NUMBER,
    ER_CODE VARCHAR2(20),
    ER_TYPE VARCHAR2(20))
    If this was generated by the system, how to correlate this object type with the package.
    I hope, the pipelined function will have system generated names that starts with SYS_PLSQL*.
    Please share your expertise. Oracle version is 11g R1.
    Regards,
    Boris
    Edited by: user12075620 on Oct 10, 2012 11:57 PM
    Edited by: user12075620 on Oct 11, 2012 12:04 AM

    >
    I have got the following object type definition by using USER_TYPES dictionar
    SQL> select dbms_metadata.get_ddl('TYPE', type_name, user) str
    2 from user_types
    3 where
    4 type_name ='SYS_PLSQL_12564004_164_1'
    5
    CREATE OR REPLACE TYPE "test"."SYS_PLSQL_12564004_164_1" as object (
    ER_KEY NUMBER,
    ER_CODE VARCHAR2(20),
    ER_TYPE VARCHAR2(20))
    If this was generated by the system, how to correlate this object type with the package.
    I hope, the pipelined function will have system generated names that starts with SYS_PLSQL*.
    Please share your expertise. Oracle version is 11g R1.
    >
    If you are asking how to find the package that created that TYPE then I don't know.
    Particularly for PIPELINED functions Oracle will create SQL types based on PL/SQL types that are declared in a package spec. See Solomon's example of this
    Re: Pipe line function
    He showed that a user that does not have the privilege to create TYPEs will still have types created this way.
    >
    As you can see, user u1 was able to create types without create type privilege.
    >
    In 10g the types are visible but in 11g Rel 2 they are hidden.
    I haven't been able to find any link between the package and system generated types. There is no linkage in PUBLIC_DEPENDENCY and I could not find any link in the system tables.
    Worse is that testing shows that if you delete the system generated type it will NOT invalidate the package. But if you then try to use it you will get an exception.
    drop type SYS_PLSQL_53616_9_1
    ORA-06553: PLS-752: Table function GET_EMP is in an inconsistent state.
    alter package pkg1 compile

  • OSB to Object Types: difference between NULL value and not available

    Hello all,
    I have a question about Object Types. More specifically, how to differentiate between an empty value (null) and a string not available.
    This is my case:
    I have created an object type with three parameters.
    CREATE OR REPLACE TYPE OSB_EMP_OBJ_TYPE AS OBJECT
    (EMP_ID NUMBER
    ,DEPT_ID NUMBER
    ,ORDER_ID NUMBER
    ,CONSTRUCTOR FUNCTION OSB_EMP_OBJ_TYPE
    RETURN self as result
    /I would like to see what happens when I put an empty string into emp_id, NULL into DEPT_ID and nothing into ORDER_ID.
    To do so I have this test script:
    declare
      p_emp OSB_EMP_OBJ_TYPE := OSB_EMP_OBJ_TYPE();
    begin
      p_emp.EMP_ID := '';
      p_emp.DEPT_ID := null;
    --  p_emp.ORDER_ID := null;
      if p_emp.EMP_ID is null
      then
        dbms_output.put_line('Empty');
      end if;
      if p_emp.DEPT_ID is null
      then
        dbms_output.put_line('NULL');
      end if;
      if p_emp.ORDER_ID is null
      then
        dbms_output.put_line('Not available');
      end if;
    end;The result of this is:
    Empty
    NULL
    Not availableIt seems that Oracle treats all three situations alike. What I would like to achieve is a way to see that p_emp.ORDER_ID was not initialized.
    To elaborate a bit: in our production system this procedure would be called from OSB and the object type would by the input for that procedure. Our database version is 10.2.0.5.0.
    Our procedures look something like this:
    procedure p_procedure ( p_emp in osb_emp_obj_type )
    is
    begin
      do_something;
    end;Can anyone tell me if there is a way to achieve this, so I can see whether or not a value in the object type was filled?
    Thanks in advance!

    Darn...
    Eventually we want to use this for an update procedure. The client gets all current data from the database by calling a webservice that (using OSB) selects the data from our database. What we want to achieve is that the client can update that data, by returning only the changed fields to an update procedure.
    We then handle an empty tag to update the field to null, and we ignore missing tags.
    OSB itself can handle this, but PL/SQL can't.
    I'm now thinking of adding an indicator to each optional field (clear_field_yn). OSB can still check for empty tags or missing tags. When a tag is empty, it's corresponding indicator will be set to 'Y'. If the tag is missing, then it will be set to 'N'.
    Is that a solution to consider, or is there a much simpler approach possible?

  • Varray of Object Type

    Hello,
    I am still very new at PL/SQL so please bare with me if you can. I am trying to learn how to store data from an object in a single varray of objects. My code below is attempting to declare an object type with 3 instance attributes and 3 instance methods of getter and setter method.
    Then i want to create a varray type to store an array of "Employee" object types.
    From here i am trying to use a loop to retrieve the first 10 ename, empno, and sal records from the emp table and store them in the variable array of 10 elements.
    Finally, I tried to use another loop to output the ename, empno, and sal in reverse order.
    My object and my object body was created successfully with no errors.
    The problem starts when I begin the anonymous block that creates the varray, this is where i get an error message at the end.
    At the end of my code is the error message i get. Can anyone suggest to me what I am doing wrong, and/or what I can do to achieve this task.
    SET SERVEROUTPUT ON
    --create object
    CREATE OR REPLACE TYPE Employee AS OBJECT(
      ename_obj VARCHAR2(10),
      empno_obj NUMBER(4),
      sal_obj NUMBER(7,2),
      MEMBER FUNCTION getename RETURN VARCHAR2,
      MEMBER FUNCTION getempno RETURN NUMBER,
      MEMBER FUNCTION getsal RETURN NUMBER);
    --create object body
    CREATE OR REPLACE TYPE BODY Employee AS
      MEMBER FUNCTION getename RETURN VARCHAR2 IS
      BEGIN
       RETURN ename_obj;
      END;
      MEMBER FUNCTION getempno RETURN VARCHAR2 IS
      BEGIN
       RETURN empno_obj;
      END;
      MEMBER FUNCTION getsal RETURN VARCHAR2 IS
      BEGIN
       RETURN sal_obj;
      END;
    END;
    --create varray of object and begin line 1 of ERROR Message--
    1> DECLARE
    2> TYPE tvrEmploy IS VARRAY(10) OF Employee;
    3>  vClient    tvrEmploy;
    4>    iCounter   integer:=1;
    5>   CURSOR client_cursor IS
    6>   SELECT ename, sal
    7>    FROM emp
    8>    WHERE rownum < 11;
    9>  BEGIN
    10>    vClient:=tvrEmploy(null,null,null,null,null,null,null,null,null,null) ;
    11>    FOR i IN client_cursor LOOP
    12>       vClient(iCounter).ename_obj:=i.ename;
    13>      vClient(iCounter).empno_obj:=i.empno;
    14>       vClient(iCounter).sal_obj:=i.sal;
    15>       iCounter:=iCounter+1;
    16>    END LOOP;
    17>    FOR I IN REVERSE 1..10 LOOP
    18>        dbms_output.put_line(to_char(I) ||' '|| vClient(I).ename_obj ||' '|| vClient(I).empno_obj ||' '||
              vClient(I).sal_obj);
    19>    END LOOP;
    20> END ;
    21> /
    --ERROR message below--
    DECLARE
    ERROR at line 1:
    ORA-06530: Reference to uninitialized composite
    ORA-06512: at line 12
    Thank you again for your time and patience.
    -Todd

    Hi,
    The error occurs on line 12, the first time through the loop, when you try to execute:
    vClient(iCounter).ename_obj:=i.ename;
    At that point, vClient (1) is not an Employee object; it's NULL.
    Try this:
    DECLARE
        TYPE tvrEmploy IS VARRAY(10) OF Employee;
        vClient    tvrEmploy;
        iCounter   integer := 1;
        CURSOR client_cursor IS
            SELECT  ename, sal
            ,       empno                                                 -- ADDED
       FROM    scott.emp
       WHERE   rownum < 11;
    BEGIN
        vClient := tvrEmploy (null,null,null,null,null,null,null,null,null,null) ;  
        FOR i IN client_cursor LOOP
            vClient (iCounter) := Employee (i.ename, i.empno, i.sal);     -- CHANGED
            iCounter := iCounter + 1;
       END LOOP;
    FOR I IN REVERSE 1..10 LOOP
           dbms_output.put_line(to_char(I) ||' '|| vClient(I).ename_obj ||' '|| vClient(I).empno_obj ||' '||
          vClient(I).sal_obj);
       END LOOP;
    END ;

  • Cannot call member function on object type

    On 8.1.6 I cannot call a member function from SQL in the way described in the manual.
    The following example is almost copied from the manual:
    create or replace TYPE foo AS OBJECT (a1 NUMBER,
    MEMBER FUNCTION getbar RETURN NUMBER);
    create or replace type body foo is
    MEMBER FUNCTION getbar RETURN NUMBER is
    begin
    return 45;
    end;
    end;
    CREATE TABLE footab(col foo);
    SELECT col,foo.getbar(col) FROM footab; -- OK
    select col,col.getbar() from footab; -- ERROR
    The second select is the way it should be, but I get an error "invalid column name".
    Using the first select, I get the result. This is strange because this is more or less the 'static member' notation (filling in the implicit self parameter myself).
    Is this a known bug in 8.1.6, maybe fixed in later versions?

    Konstantin,
    Did you use loadjava to load the compiled class into the Oracle Database?
    Regards,
    Geoff
    Hello!
    I need to write a member function for object type with java.
    for example:
    create type test as object(
    id number,
    name varchar2(20),
    member function hallo return number);
    create type body test as
    member function hallo return number
    as language java
    name 'test.hallo() return int;
    create table test of test;
    My java-file is:
    public class test {
    public int hallo() {
    return 5;
    select t.hallo() from test t;
    It's does not run. Why?
    I get always an error back. Wrong types or numbers of parameters!!
    please help me.
    thanks in advance
    Konstantin

  • Business Object type and Transactions

    Hi, gurus.
    Where can i check the matching of Business Object type with transaction type , i.e. CRM Service Process ( BUS2000116 and SLFN)?
    Is it possible to change these kind of settings? Where?
    Thanks a lot

    Hi Michele 
    The transaction you are looking for should be SWO1
    Then put the ex "BUS2000116" into the Object/Interface type and ...
    Guess it will help you
    Best Regards
    Daniel

Maybe you are looking for

  • Collection Management_Promise to Pay

    Dear All We run the worklist and create the promise to pay for overdue amount. But in the column promise to pay no value is coming. Can anybody tell us is this the standard behavior of the system or we are missing something. Thanks and Best Regards F

  • Requirement date in reservation for Stock transfer from one storage locatio

    Hi ALL, I have activated the resevration creation  by MRP for stock transfer from mail ware house to service storage location  by creating MRP area for service storage location  when there is requiremnt from service and when MRP is run on the MRP are

  • Getting text to wrap

    When I enter a new event - sometimes the text "wraps," dropping down to a second and third line if need, and I can see all the info. Other times, it doesn't wrap, and I see only the info that fits on the first line. Looked at preferences and the diff

  • Inerface to BAPI Interface

    Hi All, I have a requirement where in i need to create a BAPI as a separate interface and then call this BAPI in a BPM created in another interface. This BAPI interface is to be created in a genaralized format for reusability. Is it possible to achie

  • Investigat​e Internal Error

    Trying to investigare the error´s below but no solution was found. Would be grateful for descriptions and possible solutions. My front panel does not update (redraw) its lower part on the sceen. Same thing when not running the vi and then also the ri