Return Nested Table  Using Out Parameter

Hi Friends,
I wrote a function in which i'm using a return type as NUMBER and OUT parameter as TABLE but i'm not able to call the function in PL/SQL because of TABLE ,Can anyone plz tell me how to call the function in PL/sql using TABLE as OUT parameter. The calling function is mentioned below..
FUNCTION get_label_to_folder (
i_folder_id IN NUMBER,
i_label_id IN NUMBER,
i_new_path IN VARCHAR2,
i_src_path IN VARCHAR2 DEFAULT NULL,
--i_output_loc_type   IN       VARCHAR2,
o_vdoc_table OUT vdocs_table
RETURN NUMBER;
I tried to call that function in this manner but it won't work--
DECLARE
TYPE vdocs_table IS TABLE OF VARCHAR2 (50);
vdoc vdocs_array := vdocs_array ();
vret VARCHAR2 (20);
BEGIN
vret :=
sce_label_util.get_label_to_folder (32272,
324073,
'/test-aaaa/a1/',
NULL,
vdoc
FOR i IN vdoc.FIRST .. vdoc.LAST
LOOP
DBMS_OUTPUT.put_line (vret || ' ,' || vdoc (i));
END LOOP;
END;
Kindly check it and plz resolve the problem.
Regards,
Anand

It is not the correct approach to do this (passing a collection using an OUT parameter) using a function.
Does not matter whether you dislike it. It is still wrong.
It should be a procedure. It should likely define the OUT parameter as being passed by reference and not value in order to decrease the call overheads and increase performance.
Also note that is it not called a table. The correct terminology is a collection or an associative array. A table is something you get inside the database engine. The structure you define in the PL engine is nothing like a database table and everything like an array.
PS. And how do you expect us to determine the error? How do you expect us to test anything if we do not know what Oracle version you are using? Please.. FULL details, including Oracle version number and the full Oracle error message!

Similar Messages

  • DML on nested tables using SQL

    Hello. Can anyone tell me what's wrong??
    SQL> create type mytype as table of varchar2(20);
    Type created
    real: 78
    SQL> declare
    2 c mytype;
    3 begin
    4 select table_name bulk collect into c from user_tables;
    5 delete from table(cast(c as mytype));
    6 end;
    7 /
    declare
    ERROR at line 1:
    ORA-06550: line 5, column 13:
    PL/SQL: ORA-00903: invalid table name
    ORA-06550: line 5, column 1:
    PL/SQL: SQL Statement ignored
    real: 31

    we cannot use variables in regular SQL. It has to be
    dynamic, viz
    begin
    for r in ( select table_name from user_tables )
    loop
    execute immediate ' delete from '||r.table_name;
    d loop;
    end;
    /Cheers, APCyes, but user_tables was only a example. I want to load some data into nested table using BULK COLLECT and then perform some operation on this pl/sql table.
    For example:
    SELECT col BULK COLLECT INTO c FROM a_table;
    SELECT * BULK COLLECT INTO d FROM TABLE(CAST (c AS sql_type));
    --After that c and d contain the same data
    --but for example
    UPDATE TABLE(CAST(c AS sql_type)) Set c.col=...;
    generates invalid table name.
    Why SELECT INTO works, and UPDATE doesn't (all of this was in PL/SQL context, not SQL).

  • Get more the one records  in  procedure by using out parameter

    Hi good evening every body,
    how to get more the one records in procedure by using out parameter ,
    give me one example of it.
    regards
    subba

    Like this ?
    SQL> set serverout on
    SQL> declare
      2    v_empno dbms_sql.Number_Table;
      3    v_ename dbms_sql.Varchar2_Table;
      4    PROCEDURE P1(p_in_deptno IN emp.deptno%TYPE,
      5                 p1_out OUT  dbms_sql.Number_Table,
      6                 p2_out OUT  dbms_sql.Varchar2_Table) IS
      7    BEGIN
      8      SELECT empno, ename BULK COLLECT
      9        INTO p1_out, p2_out
    10        FROM emp
    11       WHERE deptno = p_in_deptno;
    12    END;
    13  BEGIN
    14    P1(20, v_empno, v_ename);
    15    FOR i in 1 .. v_ename.COUNT LOOP
    16      dbms_output.put_line(v_empno(i) || '--' || v_ename(i));
    17    END LOOP;
    18  END;
    19  /
    7369--SMITH
    7566--JONES
    7788--SCOTT
    7876--ADAMS
    7902--FORD
    7941--ABCDEFGHIJKLMNOPQRSTUVWXYZAAAAAA
    7942--MY#@ ' "ABC
    PL/SQL procedure successfully completed.
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need to return dynamic column names for a function returning nested table

    I am having a pl/sql function which is returning a nested table.
    For this i have defined an object which is having 4 attributes- 1 number type, 3 varchar2 type -p1,p2,p3.
    My function is taking input parameter v1,v2,v3 all of varchar2 type.Inside the function body,i am using these (v1,v2,v3) to filter data from an sql query and i am also
    using pivot function in this sql query.
    At the end my function is returning the object as defined in the starting .
    When i am excuting this function,thru select statement :
    select * from table(f1_test('A','B','C'));
    i am geting p1,p2,p3 as column name ,which are names used when i had defined object type.Instead i want column name to be dynamic (wotever i am passing in function as
    parameter while executing the function ,here A,B,C)
    Please help me in geting column names dynamic as passed in input parameter (i.e A,B,C for this case )
    Sample code for the problem:
    create or replace TYPE obj1 AS OBJECT
    ( id number(5,0)
    ,p1 varchar2(10),
    ,p2 varchar2(10)
    ,p3 varchar2(10)
    create or replace TYPE tt1 AS TABLE OF OBJ1;
    create or replace
    function f1_test (v1 varchar2,v2 varchar2,v3 varchar2)
    return tt1 as
    v_return tt1 ;
    v_str varchar2(30000);
    begin
    v_str:='
    select
    cast(
    multiset(
    select * from
    select
    aa.report_id
    ,cc.name
    ,e.amount
    from
    aa,cc,e
    where
    <join conditions>
    and cc.name in ('''||v1||''','''||v2||''','''||v3||''')
    pivot (sum (amount) for name in ('''||v1||''' as '||v1||','''||v2||''' as '||v2||','''||v3||''' as '||v3||'))
    as tt1)
    from
    dual';
    dbms_output.put_line(v_str);
    execute immediate v_str
    into
    v_return ;
    return v_return;
    end;
    Edited by: 845831 on 20 Mar, 2011 12:15 PM

    select id,p1 A,p2 B,p3 C from table(f1_test('A','B','C'));
    drop function f1_test;
    drop type tt1;
    drop type obj1;
    create or replace TYPE obj1 AS OBJECT
    ( id number(5,0)
    ,p1 varchar2(10)
    ,p2 varchar2(10)
    ,p3 varchar2(10)
    create or replace TYPE tt1 AS TABLE OF OBJ1;
    CREATE OR REPLACE
      FUNCTION f1_test(
          v1 VARCHAR2,
          v2 VARCHAR2,
          v3 VARCHAR2)
        RETURN tt1
      AS
        v_return tt1 ;
        v_str VARCHAR2(30000);
      BEGIN
        v_str:='select cast(multiset(select 1,''20'',''30'',''40'' from dual) as tt1) from dual';
        dbms_output.put_line(v_str);
        EXECUTE immediate v_str INTO v_return ;
        RETURN v_return;
      END;
    /

  • Procedure with table type out parameter

    Hi,
    I need to create a procedure which gives back a content of a table as an out parameter.
    i have tried something like below code
    it might not be correct since i am writing from home and cannot access any oracle db right now
    create or replace procedure test (
    table_out test_table%rowtype
    ) as
    type table_out test_table%rowtype
    begin
    select * into table_out
    from test_table
    where country = 'HUN';
    end;
    compile doesnt gives error, but when running it i get error
    declare
    table_out test_table%rowtype
    begin
    test( table_out );
    dbms_output.put_line( table_out );
    end;
    but it fails, could you help how to solve the above problem and call the proc correctly?
    thanks in advance

    Well you said you want the content of a table but your example says you just want a record. So for a record:
    CREATE OR REPLACE PROCEDURE sp_test (EMP_REC OUT EMP%ROWTYPE) IS
    BEGIN
        select * into emp_rec from emp where empno = 7369;
    END;The anonymous block to run it might be:
    declare
    tab_out emp%rowtype;
    begin
    sp_test(tab_out);
    dbms_output.put_line(tab_out.ename);
    end;As damorgan said the dbms_output can't be used with the record type. Notice I used it for the ENAME value of the record.
    If you really want the entire table then do it the way damorgan suggests. A pipeline function can give you the table but not as an OUT parameter.

  • Performance issue with using out parameter sys_refcursor

    Hello,
    I'm using Oracle 10g, with ODP.Net in a C# application.
    I'm using about 10 stored procedures, each having one out parameter of sys_refcursor type. when I use one function in C# and call these 10 sp's, it takes about 78ms to excute the function.
    Now to improve the performance, I created one SP with 10 output parameters of sys_refcursor type. and i just call this one sp. the time taken has increased , not it takes abt 95ms.
    is this the right approach or how can we improve the performance by using sys_refcursor.
    please suggest, it is urgent, i'm stuck up with this issue.
    thanks
    shruti

    With 78ms and 95ms are you talking about milliseconds or minutes? If it's milliseconds then what's the problem and does it really matter if there is a difference of 17 milliseconds as that could just be caused by network traffic or something. If you're talking minutes, then we would need more information about what you are attempting to do, what tables and processing is going on, what indexes you have etc.
    Query optimisation tips can be found on this thread.. When your query takes too long ....
    Without more information we can't really tell what's happening.

  • Ceating nested table using data binding.

    Hi,
    My requirement is to create a table using ADF data binding where against a value in column 1, there are multiple rows ( in the same row ) in column 2 . Something similar to what we do in excel when we join the 2 horizontal cells.
    I am providing sample table layout below. I have created the backend model to match this but both table and tree not providing what i am looking for. Tree does navigate the model but present this in single column.
    ========================================================================
    Column1 Columns2 Column3
    ========================================================================
    ABC First Data31
    Second Data32
    Data33
    Should i use mange bean to render this ?
    Thanks & regards
    Pankaj.

    Hi Frank i have tried that , my requirement to have the data in different column . Somehow the sample table i put does not display the format correctly , but its like a normal table but the cell with multiple values are merged. I have tried the ADF tree which displays the data but the format is of Tree not of normal table .

  • Returning scalar value as out parameter.

    Hi,
    I have a problem with a simple stored procedure returning a scalar value as an output parameter.
    The .NET side exception is this: bold"The data reader returned by the store data provider does not have enough columns for the query requested".*bold*
    I'm using the Entity Framework Function Import.
    This is the stored procedure:
    PROCEDURE SCALAR_RETURNING_PROCEDURE (
    EMPID IN NUMBER,
    RAISE in NUMBER,
    NEWSAL OUT NUMBER)
    IS
    BEGIN
    UPDATE EMPLOYEES E SET E.SALARY = E.SALARY+RAISE WHERE E.EMPLOYEE_ID = EMPID;
    SELECT SALARY INTO NEWSAL FROM EMPLOYEES WHERE EMPLOYEE_ID = EMPID;
    END;
    This is the function imported by EF:
    public virtual ObjectResult<Nullable<decimal>> PACKAGE2_SCALAR_RETURNING_PROCEDURE(Nullable<decimal> eMPID, Nullable<decimal> rAISE, ObjectParameter nEWSAL)
    var eMPIDParameter = eMPID.HasValue ?
    new ObjectParameter("EMPID", eMPID) :
    new ObjectParameter("EMPID", typeof(decimal));
    var rAISEParameter = rAISE.HasValue ?
    new ObjectParameter("RAISE", rAISE) :
    new ObjectParameter("RAISE", typeof(decimal));
    //HERE THE APPLICATION STOPS
    return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<decimal>>("PACKAGE2_SCALAR_RETURNING_PROCEDURE", eMPIDParameter, rAISEParameter, nEWSAL);
    In a Controller of my MVC3 web application I call the function this way:
    public ActionResult ScalarValueBack()
    //Calling a stored procedure returning a scalar value...
    int empid = 1;
    int raise = 1000;
    ObjectParameter newsal = new ObjectParameter("NEWSAL", typeof(decimal));
    if (ModelState.IsValid)
    db.PACKAGE2_SCALAR_RETURNING_PROCEDURE(empid, raise, newsal);
    ViewBag.NEWSAL = newsal;
    return View();
    Environment:
    Windows 7, 64 bit
    Visual Studio 2010 Professional, Version 10.0.40219.1 SP1Rel
    .NET Framework Version 4.0.30319 SP1Rel
    Entity Framework 4.1 - Update 1
    ODAC 11.2.0.2.40 Beta 2 for Entity Framework and LINQ to Entities includes...
              Oracle Developer Tools for Visual Studio 11.2.0.2.40
              Oracle Data Provider for .NET 4 11.2.0.2.40
              Oracle Services for MTS 11.2.0.2.0
              Oracle Instant Client 11.2.0.2.0
    Oracle DB Server 11g
    Please Help Me!!!!!

    Resolved Myself.
    When importing the stored procedure via "Function Import" just choose the "None" option instead of the "Scalars" option even if
    the stored proc your're going to call will return a scalar value as an out param.
    the stored proc is the same as above..
    this is the funtion create by the function import in the dbContext class:
    public virtual int PACKAGE2_SCALAR_RETURNING_PROCEDURE(Nullable<decimal> eMPID, Nullable<decimal> rAISE, ObjectParameter nEWSAL)
    var eMPIDParameter = eMPID.HasValue ?
    new ObjectParameter("EMPID", eMPID) :
    new ObjectParameter("EMPID", typeof(decimal));
    var rAISEParameter = rAISE.HasValue ?
    new ObjectParameter("RAISE", rAISE) :
    new ObjectParameter("RAISE", typeof(decimal));
    return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("PACKAGE2_SCALAR_RETURNING_PROCEDURE", eMPIDParameter, rAISEParameter, nEWSAL);
    this is the calling snippet by which I call the dbContex function (from a controller class of a .NET MVC3 Web App):
    public ActionResult ScalarValueBack()
    //Calling a stored procedure returning a scalar value...
    int empid = 1;
    int raise = 1000;
    ObjectParameter newsal = new ObjectParameter("NEWSAL", typeof(decimal));
    if (ModelState.IsValid)
    db.PACKAGE2_SCALAR_RETURNING_PROCEDURE(empid, raise, newsal);
    ViewBag.NEWSAL = newsal.Value;
    return View();
    }

  • Calling a Function returing(Out parameter) Nested Table Rows in Java

    Hi,
    I am trying to call a Function which returns Nested Table rows (as Out Parameter) in Java .
    When I am trying to use
    pstmt.registerOutParameter(3, OracleTypes.OTHER);
    to capture the Out parameter in Java code , I get the follwoing error :
    java.sql.SQLException: Invalid column type
    I have even tried using OracleTypes.JAVA_OBJECT ,but I get the same error.
    If I use OracleTypes.JAVA_STRUCT I get
    java.sql.SQLException: Parameter Type Conflict: sqlType=2008
    error.
    Please help .
    Am I doing the right thing ?
    Thanks in advance.
    Ninad

    Ninad,
    Search this forum's archives for STRUCT and ARRAY and peruse the "Collections" examples on this Web page:
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/jdbc20/jdbc20.html
    Good Luck,
    Avi.

  • Calling a PL/SQL function returning Netsed Table Rows

    Hi,
    I am trying to call a Function which returns Nested Table rows (as Out Parameter) in Java .
    When I am trying to use
    pstmt.registerOutParameter(3, OracleTypes.OTHER);
    to capture the Out parameter in Java code , I get the follwoing error :
    java.sql.SQLException: Invalid column type
    I have even tried using OracleTypes.JAVA_OBJECT ,but I get the same error.
    If I use OracleTypes.JAVA_STRUCT I get
    java.sql.SQLException: Parameter Type Conflict: sqlType=2008
    error.
    Please help .
    Am I doing the right thing ?
    Thanks in advance.
    Ninad

    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/jdbc20/jdbc20.html

  • Open a cursor containing a nested table?

    I have created a table with several nested tables by following the examples in: http://otn.oracle.com/docs/products/oracle8/doc_index.htm
    I am now trying to query one of these nested tables using the techniques that are described.
    The two techniques are (page 31 of above reference):
    (1) "Flattened" query.
    (2) Nested cursor
    Both of these techniques work by simple SQL queries in SQl*Plus.
    However, I get compilation errors when using identical queries when trying to open and return a cursor in a stored procedure.
    Can you please help? Is this supported in 8.1.7?
    Is there a better way to query and return data using OO4O to a windows client program?
    If necessary, I would be glad to provide code samples.
    Thank you,
    Casey Cummings

    Here is a copy of my test code for the question that I posted. Any help on how I can get nested table data back to a windows client would be greatly apreciated.
    Thank you.
    Casey Cummings
    --DDL.
    --Original table.
    CREATE TABLE MY_TABLE(
    MY_KEY INTEGER,
    MY_DATA VARCHAR2(2000));
    --Basic Object types.
    CREATE TYPE MY_NUMERIC_OBJTYP AS OBJECT(
    SEQUENCE INTEGER,
    DATUM NUMBER);
    CREATE TYPE MY_TEXT_OBJTYP AS OBJECT(
    SEQUENCE INTEGER,
    DATUM VARCHAR2(255));
    --Table type. Table of basic objects.
    CREATE TYPE MY_NUMERIC_TABTYP AS TABLE OF MY_NUMERIC_OBJTYP;
    CREATE TYPE MY_TEXT_TABTYP AS TABLE OF MY_TEXT_OBJTYP;
    --Add nested tables to original table.
    ALTER TABLE MY_TABLE ADD(
    MY_NUMERIC_NTAB MY_NUMERIC_TABTYP)
    NESTED TABLE MY_NUMERIC_NTAB STORE AS MY_NUMERIC_TABLE;
    ALTER TABLE MY_TABLE ADD(
    MY_TEXT_NTAB MY_TEXT_TABTYP)
    NESTED TABLE MY_TEXT_NTAB STORE AS MY_TEXT_TABLE;
    --Insert test data in the main, unnested table.
    INSERT INTO MY_TABLE(
    MY_KEY, MY_DATA
    )VALUES(
    1001, 'RECORD-1001');
    COMMIT;
    --Create the actual nested tables.
    UPDATE MY_TABLE SET
    MY_NUMERIC_NTAB = MY_NUMERIC_TABTYP();
    UPDATE MY_TABLE SET
    MY_TEXT_NTAB = MY_TEXT_TABTYP();
    COMMIT;
    --Insert test data into the nested tables.
    INSERT INTO TABLE(
    SELECT X.MY_NUMERIC_NTAB
    FROM MY_TABLE X
    WHERE MY_KEY = 1001
    )VALUES(
    1,901);
    INSERT INTO TABLE(
    SELECT X.MY_NUMERIC_NTAB
    FROM MY_TABLE X
    WHERE MY_KEY = 1001
    )VALUES(
    2,902);
    INSERT INTO TABLE(
    SELECT X.MY_NUMERIC_NTAB
    FROM MY_TABLE X
    WHERE MY_KEY = 1001
    )VALUES(
    3,903);
    INSERT INTO TABLE(
    SELECT X.MY_TEXT_NTAB
    FROM MY_TABLE X
    WHERE MY_KEY = 1001
    )VALUES(
    1,'ONE');
    COMMIT;
    BOTH OF THESE QUERYS WORK WHEN ENTERED IN SQL*PLUS.
    --"FLATTENED" QUERY
    SELECT X.MY_DATA, N.SEQUENCE, N.DATUM, T.SEQUENCE, T.DATUM
    FROM
    MY_TABLE X,
    TABLE(X.MY_NUMERIC_NTAB) N,
    TABLE(X.MY_TEXT_NTAB) T
    WHERE X.MY_KEY = 1001;
    --"CURSOR" QUERY
    SELECT X.MY_DATA,
    CURSOR(
    SELECT *
    FROM TABLE (MY_NUMERIC_NTAB) ),
    CURSOR(
    SELECT *
    FROM TABLE (MY_TEXT_NTAB) )
    FROM MY_TABLE X
    WHERE X.MY_KEY = 1001;
    CREATE OR REPLACE PACKAGE MANAGE_TEST AS
    TYPE THE_CURSOR IS REF CURSOR;
    PROCEDURE QUERY_TEST(
    MY_CURSOR IN OUT THE_CURSOR
    END;
    CREATE OR REPLACE PACKAGE BODY MANAGE_TEST AS
    PROCEDURE QUERY_TEST(
    MY_CURSOR IN OUT THE_CURSOR
    AS
    BEGIN
    OPEN MY_CURSOR FOR
    --"FLATTENED" QUERY
    SELECT X.MY_DATA, N.SEQUENCE, N.DATUM, T.SEQUENCE, T.DATUM
    FROM
    MY_TABLE X,
    TABLE(X.MY_NUMERIC_NTAB) N,
    TABLE(X.MY_TEXT_NTAB) T
    WHERE X.MY_KEY = 1001;
    END;
    END;
    *****************Errors:
    LINE/COL ERROR
    8/5 PL/SQL: SQL Statement ignored
    11/13 PLS-00201: identifier 'X.MY_NUMERIC_NTAB' must be declared
    CREATE OR REPLACE PACKAGE BODY MANAGE_TEST AS
    PROCEDURE QUERY_TEST(
    MY_CURSOR IN OUT THE_CURSOR
    AS
    BEGIN
    OPEN MY_CURSOR FOR
    --"CURSOR" QUERY
    SELECT X.MY_DATA,
    CURSOR(
    SELECT *
    FROM TABLE (MY_NUMERIC_NTAB) ),
    CURSOR(
    SELECT *
    FROM TABLE (MY_TEXT_NTAB) )
    FROM MY_TABLE X
    WHERE X.MY_KEY = 1001;
    END;
    END;
    *****************Errors:
    LINE/COL ERROR
    11/11 PLS-00103: Encountered the symbol "SELECT" when expecting one of
    the following:
    ( ) - + mod not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable>
    table avg count current exists max min prior sql stddev sum
    variance execute multiset the both leading trailing forall
    year month DAY_ HOUR_ MINUTE_ second TIMEZONE_HOUR_
    TIMEZONE_MINUTE_ time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL stri
    12/41 PLS-00103: Encountered the symbol "," when expecting one of the
    following:
    ; return returning and or
    null

  • Please help with multiple insert query into nested table!!!!

    I am having a problem with inserting multiple references to objects into a nested table using the following query:
    INSERT INTO TABLE(SELECT Taken_by FROM courses WHERE course_number= 001)
    (SELECT REF(p) FROM persons p
    WHERE p.enroled_in = 'Computing for Business'
    The database says that p.enroled_in is an invalid identifier. I know why this is. This is because the field enroled_in is part of a subtype of person called student_type and the query above is not accounting for this properly. I would like to know the correct syntax to use so I can insert into the nested table wherever a student is enroled into the 'computing for business' course. My full schema is below:
    CREATE TYPE person_type;
    CREATE TYPE student_type;
    CREATE TYPE staff_type;
    CREATE TYPE course_type;
    CREATE TYPE module_type;
    CREATE TYPE address_type AS OBJECT
    Street VARCHAR2 (30),
    Town     VARCHAR2 (30),
    County VARCHAR2 (30),
    Postcode VARCHAR2 (9)
    CREATE TYPE person_type AS OBJECT
    Name VARCHAR2 (50),
    Address address_type,
    DOB     DATE
    ) NOT FINAL;
    CREATE TYPE staff_type UNDER person_type
    Staff_number NUMBER (2,0)
    ) FINAL;
    CREATE TYPE student_type UNDER person_type (
    Student_number NUMBER (2,0),
    Enroled_in VARCHAR2(50),
    MEMBER FUNCTION getAge RETURN NUMBER
    )NOT FINAL;
    CREATE OR REPLACE TYPE BODY student_type AS
    MEMBER FUNCTION getAge RETURN NUMBER AS
    BEGIN
    RETURN Trunc(Months_Between(Sysdate, DOB)/12);
    END getAge;
    END;
    CREATE TYPE module_type AS OBJECT
    Module_number VARCHAR2(6),
    Module_name VARCHAR2(50),
    Credit NUMBER(2,0),
    Taught_in VARCHAR2(50)
    CREATE TYPE students_tab AS TABLE OF REF person_type;
    CREATE TYPE modules_tab AS TABLE OF REF module_type;
    CREATE TYPE course_type AS OBJECT
    Course_number NUMBER (2,0),
    Course_name VARCHAR2(50),
    Dept_name VARCHAR2(50),
    Taken_by Students_tab,
    Contains Modules_tab
    CREATE TABLE modules OF module_type(
    constraint pk_modules primary key (Module_number)
    CREATE TABLE courses OF course_type(
    constraint pk_courses primary key (Course_number)
    NESTED TABLE Taken_by STORE AS students_nt,
    NESTED TABLE Contains STORE AS modules_nt;

    By the way I am using oracle 9i and trying to insert into the nested table data from a subtype (i.e student is a subtype of person)

  • Proble with out parameter

    Dear all i am facing a Problem in oracle 10 g while calling a procedure. this procedure has one 'IN' and three 'Out' parameter( one out parameter is refcursor)
    this procedure run successfully and has no complier error. but does not return any value
    but if i remove one out parameter ie (total two with one ref cursor )it works perfectly and returns value )
    so please any one can tell me is there any limit of using out parameter with ref cursor as out parameter

    Dear arun here is the code
    PROCEDURE Sp_Report_Manager(MODULEID IN VARCHAR,
    FROM_DATE IN DATE,
    TO_DATE IN DATE,
    P_ERROROCCURRED OUT NUMBER,
    COLUMN_NAMES OUT VARCHAR,
    REC_DEALDATA OUT Globrefcursor.gref)
    IS
    LV_SQL VARCHAR2(4000);
    LV_GRID_SQL VARCHAR2(4000);
    BEGIN
    p_debug('a','1');
    P_ERROROCCURRED:=0;
    p_debug('a','2');
    IF MODULEID IS NOT NULL THEN
    BEGIN
    p_debug('a','3');
    COLUMN_NAMES:='SELECTED,CPARTY,DEAL_ID,SCHEME,TRAN_TYPE,ASSET_TYPE,ASSET_GROUP,VALUE_DATE^Select,Deal ID,Scheme,Tran Type,Asset Type,Asset Group,Trade Date';
    LV_SQL := 'SELECT GRID_SQL FROM DEA_REPORT_MANAGER WHERE MODULE = :1';
    p_debug('a','4');
         EXECUTE IMMEDIATE LV_SQL INTO LV_GRID_SQL USING MODULEID;
         p_debug('a','5');
         LV_SQL := 'SELECT 0 SELECTED,CPARTY,DEAL_ID,SCHEME,TRAN_TYPE,ASSET_TYPE,ASSET_GROUP,VALUE_DATE FROM ( ';
         LV_SQL := LV_SQL || LV_GRID_SQL;
         LV_SQL := LV_SQL || ' ) WHERE DEAL_STATUS NOT IN (''DELETE'',''REJECT'') AND VALUE_DATE BETWEEN :1 AND :2 ORDER BY DEAL_ID';
    p_debug('a','6');
    OPEN REC_DEALDATA FOR LV_SQL USING FROM_DATE, TO_DATE;
    p_debug('a','7');
    RETURN;
    END;
    END IF;
    END Sp_Report_Manager;

  • Insert data into nested tables

    Hi,
    Can someone please advice how can I insert data into nested tables using APEX.
    I have a table "employee" and a column addresses of type address_table_type object which has address1, address2, address3 columns. I want to create form in APEX that will collect address1, address2, address3. I wonder how to do this? should the item be based in database item? if yes then how can I point to the column of address_table_type
    Thanks
    --Aali                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Can you post your tabB type, sample data, and your exact insert statement?
    Is it overwriting or not commiting the inserts?
    Have you traced your session to see what is happening?

  • How to update Nested tables with xsu

    Hello,
    I have three tables.
    1) DEPARTMENT_TAB
    2) EMPLOYEE_TYP
    3) ADDRESS_TYP
    ADDRESS_TYP is a collection and it is nested inside EMPLOYEE_TYP.
    EMPLOYEE_TYP is a collection and it is nested inside DEPARTMENT_TAB.
    created with below scropt
    CREATE TYPE ADDRESS_TYP AS OBJECT (CITY VARCHAR2(10), STATE VARCHAR2(2));
    CREATE TYPE ADDRESS_TYP_NT AS TABLE OF ADDRESS_TYP;
    CREATE TYPE EMPLOYEE_TYP AS OBJECT (EMPNO NUMBER(4), ENAME VARCHAR2(10), ADDRESS_VAR ADDRESS_TYP_NT);
    CREATE TYPE EMPLOYEE_TYP_NT AS TABLE OF EMPLOYEE_TYP;
    CREATE TABLE DEPARTMENT_TAB (DEPTNO NUMBER(4), DNAME VARCHAR2(10), EMPLOYEE_VAR EMPLOYEE_TYP_NT)
         NESTED TABLE EMPLOYEE_VAR STORE AS EMPLOYEE_TAB
         ( NESTED TABLE ADDRESS_VAR STORE AS ADDRESS_TAB);
    I inserted two rows in DEPARTMENT_TAB and their nested tables using normalsql. and i generated below xml content using XSU java API
    oracle.xml.sql.query.OracleXMLQuery
    My Question is How to UPDATE a row in ADDRESS_TAB using XSU java API
    oracle.xml.sql.dml.OracleXMLSave.
    (When i was trying to update address_tab nested table's row with xml input file. it is deleting other existing rows)
    Thanks.

    Why do you say it does not work?

Maybe you are looking for