How to represent Nested table as variable/object in OIC

Hi all

I'm new to the BEAK.

I now have the nested in my database table.
Nested table:
Create the type type1 as an object (name varchar2 (20));
Create the type type2 as type1 table;
create table table1 (varchar2 (20) col1, col2 type2) store col2 table nested as table2;

Can someone help me to col2 as C structure/typedef to use it with OCIDefineObject?

You can take a look at Chapter 11 of the Guide to the programmer of the OIC. Look at the Collections inside section. You can represent the nested as OCITable table *. In addition, you can generate a representation of the structure of your object using OTT type. Please let us know if that answers your question. In the case where you are not able to proceed please let us know.

Thank you
Sumit

Tags: Database

Similar Questions

  • How to get Nested table function

    Hi friends,

    In a package, I created a nested table type name Varchar2 EmployeeCodeList.

    Then, I created a function whose return type is EmployeeCodeList. But I don't get how to get the values of this function?

    TYPE EmployeeCodeList IS TABLE OF THE VARCHAR2 (30);

    FUNCTION GenerateRandomEcF (Ec_length NUMBER, NumberOfEmp NUMBER)

    < < the function code > >

    RETURN v_RandomEmpCodes;

    END GenerateRandomEcF;

    PROCEDURE GenerateEmpFile (NumberOfEmp NUMBER, Start_SN NUMBER, EmpValue NUMBER, VARCHAR2, VARCHAR2, Ec_length NUMBER EmpGroup HireDate) IS

    v_Filename VARCHAR2 (40);

    v_EmployeeCodes EmployeeCodeList;

    v_EmpBatchF UTL_FILE. TYPE_DE_FICHIER;

    BEGIN

    v_Filename: = 'EMPLOYEE_BATCH_ ' | TO_CHAR (SYSTIMESTAMP, 'YYYYMMDD_HHMISS'): '. DAT';

    v_EmployeeCodes: = EmployeeCodeList (NumberOfEmp);

    v_EmployeeCodes: = SELECT * FROM TABLE (GenerateRandomAcF (Ac_length, NumberOfVoucher));

    v_EmpBatchF: = UTL_FILE. FOPEN ('EXT_VOUCHER_DIR', v_Filename, 'W');

    IF UTL_FILE.IS_OPEN (v_EmpBatchF) THEN

    FOR i IN 1.NumberOfVoucher LOOP

    UTL_FILE. Put_line (v_EmpBatchF, v_EmployeeCodes (i) |) ',' || Start_SN + (i-1). «, » || EmpValue | «, » || HireDate. «, » || EmpGroup);

    END LOOP;

    END IF;

    END GenerateEmpFile;

    How the line highlighted code above must be written so that I can get value of function in a variable of the same type of nested table.

    If you use the second approach, I mean

    56 v_EmployeeCodes: = GenerateRandomAcF (Ac_length, NumberOfEmployee);

    then the collection must be initialized using the constructor method. Change line 33.48 as number below

    33 v_RandomEmployeeCodes EmployeeCodeList: = EmployeeCodeList();

    48 v_EmployeeCodes EmployeeCodeList: = EmployeeCodeList();

    This is because when you use BULK COLLECT, Oracle automatically populates the collection without initialization. But if you do not COLLECT in BULK, then the collection must be initialized before filling / extending. Otherwise, you will get error of REFERENCE to the COLLECTION that is not INITIALIZED. So this should be the code, you should use. When you do not select... INTO, you might well declare the function is private and it is not necessary to declare in the package specification.

    SQL > CREATE OR REPLACE PACKAGE BODY GenerateEmployeePackage AS

    2 PROCEDURE Get_AC_Range (Ac_length NUMBER, Range_Start SERIES, certain Range_End NUMBER)

    3 EAST

    4 BEGIN

    5 If Ac_length = 8 THEN

    6 Range_Start: = 10000000;

    7 Range_End: = 99999999;

    8 Ac_length ELSIF = 9 THEN

    9 Range_Start: = 100000000;

    10 Range_End: = 999999999;

    11 Ac_length ELSIF = 10 THEN

    12 Range_Start: = 1000000000;

    13 Range_End: = 9999999999;

    14 Ac_length ELSIF = 11 THEN

    15 Range_Start: = 10000000000;

    16 Range_End: = 99999999999;

    17 ELSIF Ac_length = 12 THEN

    18 Range_Start: = 100000000000;

    19 Range_End: = 999999999999;

    20 Ac_length ELSIF = 13 THEN

    21 Range_Start: = 1000000000000;

    22 Range_End: = 9999999999999;

    23 Ac_length ELSIF = 14 THEN

    24 Range_Start: = 10000000000000;

    25 Range_End: = 99999999999999;

    26 END IF;

    27 END Get_AC_Range;

    28

    GenerateRandomAcF FUNCTION 29 (Ac_length NUMBER, NumberOfEmployee NUMBER)

    30 BACK IS EmployeeCodeList

    31 NUMBER Range_Start;

    32 Range_End NUMBER;

    33 v_RandomEmployeeCodes EmployeeCodeList: = EmployeeCodeList ();

    BEGIN 34

    35 Get_AC_Range (Ac_length, Range_Start, Range_End);

    36 v_RandomEmployeeCodes.extend (NumberOfEmployee);

    37

    38 FOR I IN 1.NumberOfEmployee LOOP

    39 v_RandomEmployeeCodes (i): = TRUNC (DBMS_RANDOM.value (down-online Range_Start, high-online Range_End));

    40 END LOOP;

    41

    42 v_RandomEmployeeCodes RETURN;

    43

    END 44 GenerateRandomAcF;

    45

    GenerateEmployeeFile PROCEDURE 46 (NumberOfEmployee NUMBER of Start_SN NUMBER, EmployeeValue NUMBER, displayed EmployeeGroup VARCHAR2, VARCHAR2, Ac_length NUMBER) IS

    47 v_Filename VARCHAR2 (40);

    48 v_EmployeeCodes EmployeeCodeList: = EmployeeCodeList ();

    49 v_EmployeeBatchF UTL_FILE. TYPE_DE_FICHIER;

    BEGIN 50

    51 v_Filename: = 'Employee_BATCH_ ' | TO_CHAR (SYSTIMESTAMP, 'YYYYMMDD_HHMISS'): '. DAT';

    52 v_EmployeeCodes: = EmployeeCodeList();

    53

    54 get nested table function

    55 - SELECT * COLLECT in BULK IN TABLE v_EmployeeCodes (GenerateRandomAcF (Ac_length, NumberOfEmployee));

    56 v_EmployeeCodes: = GenerateRandomAcF (Ac_length, NumberOfEmployee);

    57 v_EmployeeBatchF: = UTL_FILE. FOPEN ('EXT_Employee_DIR', v_Filename, 'W');

    58

    59 if UTL_FILE.IS_OPEN (v_EmployeeBatchF) THEN

    60. FOR i IN v_EmployeeCodes.FIRST... v_EmployeeCodes.Last LOOP

    UTL_FILE 61. Put_line (v_EmployeeBatchF, v_EmployeeCodes (i) |) ',' || (Start_SN + (i-1)). «, » || EmployeeValue | «, » || Posted | «, » || EmployeeGroup);

    LOOP END 62;

    63 END IF;

    64

    END 65 GenerateEmployeeFile;

    66

    END 67 GenerateEmployeePackage;

    68.

  • How can you add item (object) complex "nested table"?

    Hello I did some reading on * "Associative" * and * "Nested Table" * and I would like to enumerate the collection using the later version (http://www.devshed.com/c/a/Oracle/Database-Interaction-with-PLSQL-Nested-Tables/2/)
    -know list "Nested Table"

    However, encountered problem try to * 'EXTEND' * my nested table (add items to the complex type or OBJECT I defined, namely 'TmpHierarchyMapObjType' below) - detail as follows:

    -NOTE 1: Here's how to create the type object (be well if I just say "CREATE or REPLACE TYPE TmpHierarchyMapObjType AS OBJECT (_TMP_HIERACHICAL. ROWTYPE_)"instead of having to duplicate the column definition.
    CREATE OR REPLACE TYPE TmpHierarchyMapObjType AS OBJECT
    (
    ID numeric (19.0),.
    ParentId numeric (19.0),.
    ChildId numeric (19.0),.
    ...
    TmpUID varchar2 (32),
    ReferencedId numeric (19.0),.
    ...
    );

    -NOTE 2: I can't put 'TmpHierarchyMapObjType' inside the package, but it's not crucial, I guess.
    Types of CREATE or REPLACE PACKAGE
    AS
    TYPE cursorType IS REF CURSOR;
    TYPE TmpHiearchyMapTableType IS TABLE OF THE TmpHierarchyMapObjType; / * Use 'Nested Table' instead of an associative array * /.
    / * TYPE TmpHiearchyMapTableType IS TABLE OF THE TMP_HIERARCHYMAP % ROWTYPE INDEX DIRECTORY. */
    END;

    -NOTE 3: Here is my FUNCTION TABLE that now returns a "Nested Table" as assumed to 'Associative' (with a syntax different enumeration)
    FUNCTION to CREATE or REPLACE spGetParentsTable
    (
    Number to the ObjectId,
    ObjectClassifier varchar2
    )
    RETURN types . TmpHiearchyMapTableType -now a 'Nested Table', not 'voluntary '.
    IS
    Types of TmpHierarchyMap. TmpHiearchyMapTableType;
    ThisTempId varchar2 (32);
    CURSOR spGetParents_cursor IS
    SELECT
    ReferencedId Id,
    ParentId,
    ChildId,
    ...
    OF TMP_HIERARCHYMAP
    WHERE TmpUID = ThisTempId;
    BEGIN
    SELECT sys_guid() IN the double ThisTempId;

    spRecursiveGetParents (ObjectId, ObjectClassifier, ThisTempId);

    -(Commentary) TmpHierarchyMapMAX: = 0;
    FOR oMap in spGetParents_cursor LOOP
    -(Commented out) TmpHierarchyMapMAX: = TmpHierarchyMapMAX + 1;

    -QUESTION: FAILED here! How can I add/elements of complex types?
    TmpHierarchyMap.EXTEND (cast (oMap as TmpHierarchyMapObjType));

    /*
    NOTE: (In the comment) use is not "Associative", now using "nested table" instead.
    TmpHierarchyMap (TmpHierarchyMapMAX). ID: = oMap.Id;
    TmpHierarchyMap (TmpHierarchyMapMAX). ParentId: = oMap.ParentId;
    TmpHierarchyMap (TmpHierarchyMapMAX). ChildId: = oMap.ChildId;
    ...
    */
    END LOOP;

    DELETE FROM TMP_HIERARCHYMAP WHERE TmpUID = ThisTempId;

    RETURN TmpHierarchyMap;

    END spGetParentsTable;

    -Finally, I would like to enumerate the nested table.
    DECLARE
    types of oMappingTable. TmpHiearchyMapTableType;
    BEGIN

    oMappingTable: = spGetParentsTable(2,'ThinkFundamentals.Util.Security.SystemUser');

    -NOTE 4: this is my final goal!
    Select * from table (cast (oMappingtable as types.) TmpHiearchyMapTableType));

    dbms_output.put_line ('done!');
    END;


    REF:
    http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14261/Collections.htm#LNPLS005
    http://www.DevShed.com/c/a/Oracle/associative-arrays-in-Oracle-PLSQL-introduction/2/
    http://www.DevShed.com/c/a/Oracle/database-interaction-with-PLSQL-nested-tables/2/

    Hello

    Try this,

    TmpHierarchyMap.Extend();
    TmpHierarchyMap(TmpHierarchyMap.Count) := TmpHierarchyMapObjType( oMap.Id
                                                                    , oMap.ParentId
                                                                    , ... );
    

    Kind regards

    Christian Balz

  • How to fill the value in the nested table by using the object type


    Hi gurus

    I created an object type and able to fill the values in it, now I want to create a nested table type of this object and fill it but looks like I'm doing something wrong, see my code below.

    Code example

    CREATE or REPLACE TYPE countries_o
    AS
    OBJECT
    (
    COUNTRY_ID TANK (2 BYTES),
    COUNTRY_NAME VARCHAR2 (40 BYTE),
    REGION_ID NUMBER);
    /

    create or replace type countries_t is table of the countries_o;

    /

    CREATE OR REPLACE

    ABC of the PROCEDURE

    IS

    v_print countries_t; -: = arr_countries_t('01','Aus',1);

    BEGIN

    v_print: = countries_t('01','A',11);

    DBMS_OUTPUT. Put_line (v_print. COUNTRY_ID | v_print. COUNTRY_NAME | v_print. REGION_ID);

    END;

    /

    Error

    • Error (6.3): PL/SQL: statement ignored
    • Error (6,12): PLS-00306: wrong number or types of arguments in the call to 'COUNTRIES_T '.
    • Error (7.3): PL/SQL: statement ignored
    • Error (7.32): PLS-00302: component 'COUNTRY_ID' must be declared

    Thanks in advance

    Concerning

    Muzz

    Hi user,

    Here is another method that you can try-

    CREATE OR REPLACE

    ABC of the PROCEDURE

    IS

    v_print countries_t: = countries_t (countries_o('01','A',11));

    BEGIN

    DBMS_OUTPUT. Put_line (v_print (1).) COUNTRY_ID | v_print (1). COUNTRY_NAME | v_print (1). REGION_ID); -you're accessinf the first element of the nested table, which in turn points to the object.

    END;

    In the sections of the declaration you have assigned values to the nested table.

    Kind regards
    Maxou

  • How to assign values to the nested table and passes as a parameter for the procedure?

    How to assign values to the nested table and passes as a parameter for the procedure?

    Here are the object and its type

    create or replace type test_object1 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );


    create or replace type test_type1 is table of the test_object1;


    create or replace type test_object2 as an object
    (
    val1 varchar2 (50).
    val2 varchar2 (50).
    VARCHAR2 (50) val3
    );


    create or replace type test_type2 is table of the test_object2;


    GRANT ALL ON test_object1 to PUBLIC;


    GRANT ALL ON test_type1 to PUBLIC;


    GRANT ALL ON test_object2 to PUBLIC;


    GRANT ALL ON test_type2 to PUBLIC;

    Here is the table object type:

    create the table test_object_tpe
    (
    sl_num NUMBER,
    Description VARCHAR2 (100),
    main_val1 test_type1,
    main_val2 test_type2
    )


    NESTED TABLE main_val1 STORE AS tot1
    NESTED TABLE main_val2 STORE AS earlier2;


    -----------------------------------------------------------------------------------------------------------

    Here is the procedure that inserts values into the nested table:

    PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
    Description in VARCHAR2,
    p_main_val1 IN test_type1,
    p_main_val2 IN test_type2
    )
    IS
    BEGIN

    FOR rec in p_main_val1.first... p_main_val1. Last
    LOOP

    INSERT INTO xxdl.test_object_tpe
    (
    sl_num,
    Description,
    main_val1,
    main_val2
    )
    VALUES
    (
    sl_num
    description
    test_type1 (test_object1)
    p_main_val1 .val1 (CRE),
    p_main_val1 .val2 (CRE),
    p_main_val1 .val3 (rec)
    )
    )
    test_type2 (test_object2 (p_main_val2 .val1 (CRE),
    p_main_val2 .val2 (CRE),
    p_main_val2 .val3 (rec)
    )
    )

    );

    END LOOP;

    commit;

    END INSERT_TEST_DATA;

    -------------------------------------------------------------------------------------------

    Here are the block anonymoys what values attributed to the object type and pass values in the procedure:

    Set serveroutput on;

    declare

    p_sl_num NUMBER: = 1001;
    p_description VARCHAR2 (50): = 'Test Val1;

    inval1 test_type1: = test_type1();
    inval2 test_type2: = test_type2();

    Start


    inval1 (1) .val1: = "testx1";
    inval1 (1) .val2: = "testx2";
    inval1 (1) .val3: = "testx3";

    inval2 (1) .val1: = "testy1";
    inval2 (1) .val2: = "testy2";
    inval2 (1) .val3: = "testy3";

    CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
    Description = > p_description,
    p_main_val1 = > inval1,
    p_main_val2 = > inval2
    );

    end;
    /
    Someone can correct me.

    Thank you
    Lavan

    Thanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
    >
    How to assign values to the nested table and passes as a parameter for the procedure?
    >
    Well you do almost everything bad that could be hurt.

    Here is the code that works to insert data into your table (the procedure is not even necessary).

    declare
    p_sl_num NUMBER := 1001;
    p_description VARCHAR2(50) := 'Testing Val1';
    inval1 test_type1 := test_type1();
    inval2 test_type2 := test_type2();
    begin
    inval1.extend();
    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    inval2.extend();
    inval2(1) := test_object2('testy1', 'testy2', 'testy3');
    
    INSERT INTO test_object_tpe
    (
    sl_num,
    description,
    main_val1,
    main_val2
    )
    VALUES
    (p_sl_num, p_description, inval1, inval2);
    commit;
    end;
    /
    

    See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA

    1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)

    inval1(1).val1 := 'testx1';
    

    Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element

    inval1.extend();
    

    And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
    If you can not do

    inval1(1).val1 := 'testx1';
    

    You must create an instance of 'test_object1 '.

    inval1(1) := test_object1('testx1', 'testx2', 'testx3');
    

    And so on for the other collection

    You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.

  • Nested table of object type have only one record all the time

    Hi all

    I have a question regarding the storage of multiple records in a nested Table that is of type OBJECT.

    The program below that I wrote for the test and during the test, I was able to store only the last record in the nested Table.

    Please let me know what I did wrong here.

    Step 1:
    CREATE or REPLACE TYPE book_obj AS OBJECT (name varchar2 (25), author varchar2 (25), abstract varchar2 (4000));
    /

    Step 2:
    CREATE or REPLACE TYPE book_table IS TABLE OF THE book_obj;
    /

    Step 3: CREATE TABLE book (name, varchar2 (25), varchar2 (25) author, varchar2 (4000)) abstract;
    INSERT VALUES Accountants ('Harry Potter,' 'MK', 'It's magic');
    INSERT the book VALUES ("Ramayana', 'VK', 'It is mythiology'");
    COMMIT;

    Step 4:
    declare
    bookset book_table;
    ln_cnt pls_integer;
    Start
    bookset: = book_table (book_obj ('madhu', 'kongara', 'sudhan'));
    dbms_output.put_line (' the number is ' | bookset.) (Count); -> I see COUNT = 1
    bookset: = bookset_t(); -> Assignment to NULL.
    dbms_output.put_line (' the number is ' | bookset.) (Count); -> I see County 0
    for rec in (select * from book) loop-> now a loop twice.
    dbms_output.put_line (' name > ' |) Rec.Name);
    bookset: = bookset_t (book_t (rec.name, rec.author, rec.abstract));
    end loop;
    dbms_output.put_line (' the number is ' | bookset.) (Count); -> I can see COUNT = 1 (why?)
    END;

    I looped twice to fill two records in the TABLE IMBRIQUEE OF TYPE OBJECT. But when I see the Count I get only 1 and the data is also having the last record.

    Can you get it someone please let me know how to fill out the table nested with all records. Tell me where I am wrong.

    Very much appreciate your help here.

    Thank you and best regards,
    NKM

    Maldini says:
    dbms_output.put_line (' the number is ' | bookset.) (Count); -->, I can see COUNT = 1 (why?)

    Because instead of add to bookset collectionto set (ergo replacement) it a collection containing recovered book. Use:

    declare
        bookset book_table;
        ln_cnt pls_integer;
    begin
        bookset := book_table(book_obj('madhu','kongara','sudhan'));
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1
        bookset := book_table(); --> Assigning back to NULL.
        dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0
        for rec in (select * from book) loop --> Now Looping two times.
          dbms_output.put_line(' name > '||rec.name);
          bookset.extend;
          bookset(bookset.count) := book_obj(rec.name, rec.author, rec.abstract);
        end loop;
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why)
    end;
    /
    The count is 1
    The count is 0
    name > Harry Potter
    name > Ramayana
    The count is 2
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    Or better use bulk collect:

    declare
        bookset book_table;
        ln_cnt pls_integer;
    begin
        bookset := book_table(book_obj('madhu','kongara','sudhan'));
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1
        bookset := book_table(); --> Assigning back to NULL.
        dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0
        select  book_obj(name,author,abstract)
          bulk collect
          into  bookset
          from  book;
        for i in 1..bookset.count loop --> Now Looping two times.
          dbms_output.put_line(' name > '||bookset(i).name);
        end loop;
        dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why)
    end;
    /
    The count is 1
    The count is 0
    name > Harry Potter
    name > Ramayana
    The count is 2
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • How can I target a captivate variable go a web object

    How can I target a captivate variable go a web object

    window.parent.window.cpAPIInterface.getVariableValue ("cpQuizInfoStudentID");

    window.parent.window.cpAPIInterface.setVariableValue ("yourVariable", "" value");

    Window.parent.CP.Enable)

    Window.parent.CP.Disable)

    Window.parent.CP.Show)

    Window.parent.CP.Hide)

  • Format an array of multilevel nested table object in a TABLE

    DB: Oracle 11 g 2

    Platform: client windows 7

    Hello

    I have a table of multilevel nested table object.

    {code}

    CREATE OR REPLACE TYPE OBJ_1 AS OBJECT)

    NUMBER of col_1,

    col_2 VARCHAR2 (56),

    col_3 VARCHAR2 (256)

    );

    CREATE OR REPLACE TYPE ARR_1 AS TABLE OBJ_1;

    CREATE OR REPLACE TYPE OBJ_2 AS OBJECT)

    NUMBER of col_4

    col_5 Number (15),

    col_6 NUMBER (1).

    col_7 NUMBER (1).

    col_8 VARCHAR2 (56),

    col_arr ARR_1

    );

    CREATE OR REPLACE TYPE ARR_2 AS TABLE OBJ_2;

    {code}

    I want to convert this table format - I need to feed in a program. expected release:

    --------------------------------------------------------------------------------

    col_4 col_5 col_6 col_7 col_8 col_1, col_2 col_3

    --------------------------------------------------------------------------------

    1           2          3           4           5          1           2          3

    1           2          3           4           5          4           5          6

    The Toad, the following query creates the output:

    {code}

    Select *.

    table (ARR_2 (OBJ_2 (1, 2, 3, 4, '5', ARR_1 (OBJ_1 (1,2, '3'))),))

    OBJ_2 (1, 2, 3, 4, '5', ARR_1 (OBJ_1 (4.5, '6')))

    --------------------------------------------------------------------

    col_4 col_5 col_6 col_7 col_8 col_arr

    --------------------------------------------------------------------

    1           2          3          4           5           (DATASET)

    1           2          3          4           5           (DATASET)

    {code}

    Where (DATASET) is the inner nested table. So I thought I'd add a level to "function table" will do the job, but NO, mistake.

    {code}

    Select * from table)

    Select *.

    table (ARR_2 (OBJ_2 (1, 2, 3, 4, '5', ARR_1 (OBJ_1 (1,2, '3'))),))

    OBJ_2 (1, 2, 3, 4, '5', ARR_1 (OBJ_1 (4.5, '6')))

    );

    Error: ORA-02324: more than one column in THE subquery SELECT list

    {code}

    Any suggestion?

    Thank you.

    You just need to join another TABLE operator who breast COL_ARR:

    SQL > with tmp (obj) as)

    2. Select (ARR_2)

    OBJ_2 3 (1, 2, 3, 4, '5', ARR_1 (OBJ_1 (1,2, '3')));

    4 OBJ_2 (1, 2, 3, 4, '5', ARR_1 (OBJ_1 (4.5, '6')))

    5           )

    6 double

    7)

    8. Select t2.col_4, t2.col_5, t2.col_6, t2.col_7, t2.col_8

    9, t1.col_1, t1.col_2, t1.col_3

    tmp 10 t

    11, t2 table (t.obj)

    12, t1 table (t2.col_arr)

    13;

    COL_4 COL_5 COL_6 COL_7 COL_8 COL_1, COL_2 COL_3

    ---------- ---------------- ----- ----- -------- ---------- -------- -------

    1                2     3     4 5                 1 2        3

    1                2     3     4 5                 4 5        6

  • How can I build variable objects?

    Hello everyone.  As I navigate my book learning, I stumbled across another curve ball I use the Adobe Designer LC by JP Terry book and example files.  The sample file that I am struggling with right now is the 'purchaseorder.xdp '.

    My first question is how the variable object "partNoScript was built?"  I know how to go and add the variables through the form properties dialog box, but do not have the slightest idea how to build these object variables in the form in this way.

    Furthermore, I believe that I can pass to enter the learning objectives of this form.

    Thank you all for your help to understand this

    Mike

    You can add a script object in the hierarchy window.

    1. Select a subform in the tree as "form1".
    2. Open the context menu by clicking the right button of the mouse.
    3. Select the item to add a new script object below the selected object.
  • How the nested table that is stored in the database?

    How the nested table that is stored in the database?
    The nested table column is stored with the table main or separate in the database?

    A nested table is a table that is stored in the structure of another table. It is used to support the columns that contain multivalued attributes.

    If you want to use the same type in multiple places, create them on a global scale and these will be discussed under 'Types'.

  • ORA-21700: object does not exist or is marked for deletion - nested table

    Hi, please see my procedure. It comes to delete records in a table whose primary keys will be given in comma separated format.

    but he triggers the following error

    ORA-21700: object does not exist or is marked for deletion
    ORA-06512: at the 'scott '. PKG_COUNTRY', line 4598
    ORA-06512: at line 10
    Pr_Del_Regional_DtlORA-21700: object does not exist or is marked for deletion
    Process is complete.
    Disconnection from the database tfo_user-watson.


    / * In format on 12/05/2011 14:47 (trainer more v4.8.7) * /.



    Varchar_table. ARRAY TYPE IS VARCHAR2 (5); -in the scope of package


    PROCEDURE Pr_Del_Regional_Dtl)
    pi_v_country_id IN VARCHAR2, seperateed comma for deletion
    po_results ON sys_refcursor
    )
    IS
    l_varchar_table varchar_table: = varchar_table ();
    BEGIN
    pr_split_varchar_values (pi_v_country_id, l_varchar_table); -divides: separation by a comma to the nested table.

    DELETE FROM regional_setup
    WHERE country_id IN (SELECT *)
    TABLE (l_varchar_table)); -removed
    EXCEPTION
    WHILE OTHERS
    THEN
    DBMS_OUTPUT. Put_line ("Pr_Del_Regional_Dtl" |) SQLERRM);
    LIFT;
    END Pr_Del_Regional_Dtl;

    split-
    PROCEDURE pr_split_varchar_values)
    pi_v_values IN VARCHAR2,
    op_varchar_table ON varchar_table
    )
    IS
    l_v_value VARCHAR2 (3000);
    l_value VARCHAR2 (10);
    I PLS_INTEGER: = 0;
    BEGIN
    op_varchar_table: = varchar_table ();
    l_v_value: = pi_v_values;

    IN all, LENGTH (l_v_value) > 0
    LOOP
    i: = i + 1;

    IF INSTR (l_v_value, ",") > 0
    THEN
    op_varchar_table. EXTEND;
    op_varchar_table (i): =.
    LTRIM (RTRIM (SUBSTR (l_v_value, 0, INSTR (l_v_value, ",") - 1)));
    ON THE OTHER
    op_varchar_table. EXTEND;
    op_varchar_table (i): = LTRIM (RTRIM (l_v_value));
    l_v_value: = ";
    END IF;

    l_v_value: =.
    SUBSTR (l_v_value, INSTR (l_v_value, ",") + 1,
    LENGTH (l_v_value));
    END LOOP;
    END pr_split_varchar_values;

    Thanks in advance
    TYPE varchar_table IS TABLE OF VARCHAR2(5); -- in package scope
    

    Have you declared in package or database? Remember, local collection cannot be used in the SQL statement.

  • How to create indexes on the nested table.

    Hi all
    I held the syntax to create indexes on the nested table.

    I found below synta but when I try it with my table it gives me error

    CREATE UNIQUE INDEX indx_name
    ON nestedtablestore (NESTED_TABLE_ID, id);

    What is here NESTED_TABLE_ID & ID

    They are virtual your nested table

    Here is an example.

    create or replace type obj as object (no integer, address varchar2(100))
    /
    create or replace type tbl as table of obj
    /
    create table test_tbl (id integer, name varchar2(100), address tbl) nested table address store as address_nt
    /
    create unique index address_no_idx on address_nt (no, address)
    /
    

    Published by: Karthick_Arp on November 23, 2010 01:41

  • How can I change my nested table column?

    Hi all

    For example.

    Create Table MyTab
    (
    Number of Srno,
    SName varchar2 (100),
    Addr varchar2 (100)
    );

    This is my original table, but now I want to change my address of column in a nested table that having several columns in it.


    create or replace type AddrTyp as an object
    (
    LINE1 varchar2 (50).
    Line2 varchar2 (50).
    VARCHAR2 (50) line 3.
    4 varchar2 (50).
    line5 varchar2 (50).
    postadd varchar2 (10)
    );


    CREATE OR REPLACE
    TYPE DelAddr IS TABLE of the AddrTyp;


    It comes up ok but now I want to change my addr nested table column.

    as...


    ALTER table MyTab
    change the waterfall (DelAddr Addr);

    but it did not work.

    any idea?

    Indirectly!

    SQL> alter table MyTab add addr2 DelAddr NESTED TABLE addr2 STORE AS addr2_ntab;
    
    Table altered.
    
    SQL> alter table MyTab drop column addr;
    
    Table altered.
    SQL> alter table MyTab rename column addr2 to addr;
    
    Table altered.
    
    SQL> desc MyTab
     Name                                      Null?    Type
     ----------------------------------------- -------- -----------------
     SRNO                                               NUMBER
     SNAME                                              VARCHAR2(100)
     ADDR                                               DELADDR
    
    SQL>  
    
  • Collections of SQL / objects - how to store a table within a column?

    Hi guys,.

    I have a current table on production... I'm only allow you to add a column to her...

    The simplified scenario is...

    I have a table

    CREATE TABLE PLAN_TRANSACTION
    (THE ARGUMENT PLAN_ID VARCHAR2 (20) DEFAULT SYS_GUID();)
    PLAN_NUMBERS_TYPE COLUMN? );

    For the PLAN_NUMBERS column, I want to store all types and numbers associated with the PLAN_ID.


    In general, it would be

    CREATE TABLE TYPES_AND_NUMBERS
    (TYPE VARCHAR2 (20),)
    NUMBER OF NUMBERS);
    ---------------------------------
    Type A, 12345
    Type B, 12345
    Type A, 54211

    etc.

    Now instead of add another additional column PLAN_ID TYPES_AND_NUMBERS table and create a relationship of foreign key with PLAN_TRANSACTION.
    I want to keep the table inside the table PLAN_TRANSACTION column.


    I think doing this


    CREATE TYPE TYPES_AND_NUMBERS AS OBJECT
    (TYPE VARCHAR2 (20),)
    NUMBER NUMBERS);

    CREATE TABLE AS TN_TAB TYPE OF TYPES_AND_NUMBERS;


    CREATE TABLE PLAN_TRANSACTION
    (THE ARGUMENT PLAN_ID VARCHAR2 (20),)
    PLAN_NUMBERS TN_TAB
    )
    THE NESTED TABLE PLAN_NUMBERS
    STORE AS NESTED_PLAN_NUMBERS;


    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    My question is...

    Q1) is my way of creating a correct nested table?... creating an object type, then an array of objects, then storing this table within a column in a nested table...

    Q2) is otherwise easier to create a nested table as I quite new in object_relational--concepts simply, I felt quite concerned create an object to simulate a line. and create an array of object to store objects, and then put it inside a column.

    Q3) possible for me, or is it something like create type TN_TAB as table of (varchar2 TYPE, numbers);


    Thanks a lot guys!

    Best regards
    Noob

    A nested table is the easiest way to resolve this condition.
    Other solutions might involve some large objects (CLOB or XMLTYPES), but without knowing anything commercially, I think a nested table is the best way.

  • How to create a table variable

    Hi people,

    I develop a fly activity, for each branch created, I need to pass different values (that I get from DB).

    For this, my plan would be,
    -create a load of variables, array of all the values in the table (from DB)
    -pass the array to each branch in fly activity based on the index

    As I am newbie to BPEL, I don't know how to create a table variable.

    You people could guide me please.


    Concerning
    VIKI

    To add to the response of Anne:

    use XPATH to get your value

    entry/string_array / [1]
    / string_array/input [$counter]

Maybe you are looking for

  • Satellite A665 - overheating and speedfan time

    so my laptop is a toshiba a665-06f (Canadian model) which I bought from future shop, here is a link to the plug to laptophttp://209.167.114.38/support/TechSupport/productcontents/satellite/PSAW3C-06F017.htm Since I bought the thing it's always hot, s

  • How can I connect my Apple TV recently updated to a TiVo box?

    MY old Apple TV connected to the TIVO via optical cable and optical switch 3-way. The latest version of the apple TV isn't an optical cable facilities. How can I now connect to my TiVo machine.

  • Backup of Media Player library content

    I understand how to save a playlist in Media Player in My Documents / my music but how do you back up all the content of the Media Player library? My library is currently on my XP computer and I want to transfer to my new computer Windows 8.1.  My pl

  • How can I use the copy of Windows XP from the desktop on the laptop?

    loading xp with a different product code I have a laptop that works under XP. I lost track of the original disc. I also have an office which was under XP but Win 7 is working now. I have the XP installation disc. How can I use the drive of the deskto

  • Update Windows 7 SP1 / Windows 10 Upgrade

    It's my first question to this forum, but I studied several responses in the KB already nothing doesn't. Appreciate you all take it a little easy on me. :) I was not able to install the Windows SP1 (little I didn't know that my automatic update never