Error in initialization of multilevel nested table type

Hello

Database version: Oracle 11 g R2

I am creating a complex process I need to create complex nested table types and use them in code.

{code}

CREATE or REPLACE TYPE ws_data_compare_rt

AS AN OBJECT

(

external_web_service_id NUMBER (10),

service_code VARCHAR2 (30),

ws_bridging_id NUMBER (10),

ws_attribute_name VARCHAR2 (64).

ws_attribute_value VARCHAR2 (32767).

in_source_attribute VARCHAR2 (30),

in_source_value VARCHAR2 (32767).

comparison_rule VARCHAR2 (100)

);

CREATE or REPLACE TYPE ws_data_compare_tt IS TABLE OF THE ws_data_compare_rt;

CREATE or REPLACE TYPE ws_data_compare_master_rt

AS AN OBJECT

(

key_attribute_1 VARCHAR2 (30),

NUMBER of key_attribute1_value

key_attribute_2 VARCHAR2 (30),

NUMBER of key_attribute2_value

m_ws_data_compare_tt ws_data_compare_tt

);

/

CREATE or REPLACE TYPE ws_data_compare_master_tt IS TABLE OF THE ws_data_compare_master_rt;

{code}

The objects have been created successfully. However when I use it in my code, I need to initialize them, but I get an error for the variable of ws_data_compare_master_tt type initialization.

{code}

...

g_ws_data_compare_rt ws_data_compare_rt: = ws_data_compare_rt (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

g_ws_data_compare_tt ws_data_compare_tt: = ws_data_compare_tt();

g_ws_data_compare_master_rt ws_data_compare_master_rt: = ws_data_compare_master_rt (NULL, NULL, NULL, NULL, g_ws_data_compare_tt);

g_ws_data_compare_master_tt ws_data_compare_master_tt: = ws_data_compare_master_tt();

...

{code}

I'm unable to initialize the variable g_ws_data_compare_master_tt of type ws_data_compare_master_tt that I get the below error.

For PACKAGE BODY UTL compile errors. PKG_WS_UTIL

Error: PLS-00222: no function with name 'WS_DATA_COMPARE_MASTER_TT' does exist in this scope

Line: 28

Text: g_ws_data_compare_master_tt ws_data_compare_master_tt: = ws_data_compare_master_tt();

Error: PL/SQL: ignored element

Line: 28

Text: g_ws_data_compare_master_tt ws_data_compare_master_tt: = ws_data_compare_master_tt();

Can someone help me to find out what is the problem?

Thanks in advance.

Kind regards

Natarajan

Ah, I found the problem on my own. It was because of a bad statement similarly variable g_ws_data_compare_master_tt in a table in the specification of the package that was trouble. However I wonder the error returned Oracle was not fully exposed.

Kind regards

Natarajan

Tags: Database

Similar Questions

  • Error in the importation of tables with nested table types

    Hello

    I have two tables with the nested table type when I m try to import a schema to another all tables with error to give the type of identifying different

    Here is my order of import
    imp leader = tables_nested.dmp ignore = y fromuser = ABC touser = DEV_SCHEMA toid_novalidate = sup_payment_type
    I tried to import with the option TOID_NOVALIDATE, but it says
    IMP-00086: TOLD 'SUP_PAYMENT_TYPE' not found in the export file


    Here, the view of my log file.

    . . table import 'CONTRACT' 788 imported lines
    . . importation of "EQUIPMENT" 4301 imported table lines
    . . rows in table 'CONT_EQUIPMENT' import imported 4300
    IMP-00017: statement failed with error ORACLE 2304:
    "CREATE TYPE"SUP_PAYMENT_TYPE"TIMESTAMP" 2007-11 - 28:10:50:50' OID "3FF6F10."
    "CADC08A99E040A8C0010178F9"AS OBJECT ().
    "CONT_NO NUMBER".
    "EQP_NO NUMBER".
    "PMT_NO NUMBER".
    'DATE OF PLAN_PMT_DATE '.
    "S_NO NUMBER".
    "BATCH_NO NUMBER".
    'DATE OF TRAN_DT '.
    'DATE OF ACTUAL_PMT_DATE '.
    "ACTUAL_PAID_AMT_CURR NUMBER".
    "ACTUAL_PAID_AMT_KZT NUMBER".
    "PMT_CURSTYP_CD NUMBER".
    'NUMBER OF PMT_EXG_RATE);'
    IMP-00003: ORACLE error 2304
    ORA-02304: invalid literal object identifier
    IMP-00063: WARNING: jump table "DEV_SCHEMA". "" SUPPLIER_PAYMENT "as the type of the object
    'DEV_SCHEMA '. "' SUP_PAYMENT_TYPE ' could not be created or has identify different
    About to activate the constraints...

    Thank you

    Baptist

    Get the error on tahiti, I realized this must be a common problem and is described in Metaclunk.
    So in Metaclunk I get "ora-02304 imp' and came up with 1066139.6 ML.
    It describes your situation.
    So many times, it is very easy to solve your problems in a few minutes. I always wonder why people walk immediately into shock and horror and nothing to do when they hit a mistake.

    ----
    Sybrand Bakker
    Senior Oracle DBA

  • 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

  • Need help - multilevel nested table - create table problem

    Hello

    My version of oracle db: 11g

    I just created a table that contains a nested multi-level table.

    Here is the code:

    create or replace type sdef_t_nt_empNames21 is table of the varchar2 (50);

    create or replace type sdef_ot_SCmarks21 as an object (number of physics, chemistry number, number of Biology);

    create or replace type sdef_t_nt_SCmarks21 is table of the sdef_ot_SCmarks21;

    create or replace type sdef_ot_allsubmarks21 as an object (eid, eng, math, sc sdef_t_nt_SCmarks21 number number);

    create or replace type sdef_t_nt_dep_m_info21 is table of the sdef_ot_allsubmarks21;

    create the table nt_dep21

    (number of fact

    , dname varchar2 (50)

    c_sdef_t_nt_empNames21 sdef_t_nt_empNames21

    c_sdef_t_nt_dep_m_info21 sdef_t_nt_dep_m_info21)

    nested as NT_c_sdef_t_nt_empNames21 table c_sdef_t_nt_empNames21 store

    store table nested like NT_c_sdef_t_nt_dep_m_info21; c_sdef_t_nt_dep_m_info21  <-I know that the problem is here.

    TRACE OF THE ERROR:

    Error at startup on line: 13 in the command.

    create the table nt_dep21

    (number of fact

    , dname varchar2 (50)

    c_sdef_t_nt_empNames21 sdef_t_nt_empNames21

    c_sdef_t_nt_dep_m_info21 sdef_t_nt_dep_m_info21)

    nested as NT_c_sdef_t_nt_empNames21 table c_sdef_t_nt_empNames21 store

    Nested table c_sdef_t_nt_dep_m_info21 (sdef_t_nt_SCmarks21) store as NT_c_sdef_t_nt_dep_m_info21

    Error report-

    SQL error: ORA-00904: invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    PS: I'm just solve a problem given to me by some1, is not a practical implementation, I'm just trying to get through

    I'm sure that some1 could help me with this, I have searched a lot of this problem but could not find my answer, please help me.

    Concerning

    Rahul

    SQL > create table (nt_dep21)
    Did number 2,
    3 dname varchar2 (50).
    4 c_sdef_t_nt_empNames21 sdef_t_nt_empNames21,
    c_sdef_t_nt_dep_m_info21 5 sdef_t_nt_dep_m_info21
    6                       )
    store c_sdef_t_nt_empNames21 7 nested as NT_c_sdef_t_nt_empNames21 table
    store c_sdef_t_nt_dep_m_info21 8 table nested as NT_c_sdef_t_nt_dep_m_info21)
    9 table nested as NT_sc sc store
    10                                                                               )
    11.

    Table created.

    SQL >

    SY.

  • 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

  • Oracle 9 error: insert into temp-table collection (nested table)

    Hello everyone

    I have an urgent problem. I have a package which has been developed against 10g but must now be deployed on 9i as well. I don't use 10 g - features and packages compile well on 9.

    Somehow, I get the following runtime error: failed execution: ORA-22905: cannot access the rows of a no nested table item.

    The Code I use to the particular line is

    insert into tmp_report_calculation (select from table (calculations)); *

    tmp_report_calculation is a temporary table and calculations holds a collection type that is a nested table. I do not understand why the error is complaining about "No nested table. Less than 10g everything run took place.

    Can someone help me out here? Furthermore, it is important that I put the results in this temp-table (since I can't use the multiset on Oracle 9)

    concerning
    -Marc

    Try

    insert into tmp_report_calculation (select * from table(cast(calculations as your_collection_type)));
    

    replace"your_collection_type" with your name in the actual collection of course...

  • 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.

  • ORA-22907: invalid CAST to a type that is not a nested table or VARRAY. Typed collection function

    Hello

    I tried to create a function that might return the type that is created on the outside.

    So I wrote script below. until the function created it compiled successfully, but after that, when the data querying, we encountered error,

    "ORA-22907: invalid CAST to a type that is not a nested table or VARRAY.

    SQL> create table emp
      2  (
      3    ename        varchar2(200 byte),
      4    mgr          number,
      5    employee_id  number
      6  );
    
    
    Table created.
    
    
    SQL> insert into emp (ename, mgr, employee_id)
      2       values ('king', 12, 1);
    
    
    1 row created.
    
    
    SQL> insert into emp (ename, mgr, employee_id)
      2       values ('clark', 12, 2);
    
    
    1 row created.
    
    
    SQL> commit;
    
    
    Commit complete.
    
    
    SQL> create or replace type t_emp as object (ename varchar2 (200), mgr number, employee_id number);
      2  /
    
    
    Type created.
    
    
    SQL> create or replace function f_emp return  t_emp
      2   is
      3  type rc_emp is ref cursor;
      4  r_emp rc_emp;
      5  v_emp t_emp;
      6  begin
      7   open r_emp for select * from emp where rownum=1;
      8   fetch r_emp into v_emp;
      9  close r_emp;
     10  return v_emp;
     11  exception
     12      when others then
     13      dbms_output.put_line(dbms_utility.format_error_stack);
     14      dbms_output.put_line(dbms_utility.format_call_stack);
     15      dbms_output.put_line(dbms_utility.format_error_backtrace);
     16      raise_application_error(-20001,sqlerrm);
     17  end;
     18  /
    
    
    Function created.
    
    
    SQL> show errors;
    No errors.
    SQL> select * from f_emp;
    select * from f_emp
                  *
    ERROR at line 1:
    ORA-04044: procedure, function, package, or type is not allowed here
    
    
    
    
    SQL> select * from table(cast (f_emp as t_emp));
    select * from table(cast (f_emp as t_emp))
                              *
    ERROR at line 1:
    ORA-22907: invalid CAST to a type that is not a nested table or VARRAY
    
    
    
    
    SQL>
    

    Like this:

    ...

    CREATE or REPLACE TYPE t_emp_array IS TABLE OF THE t_emp;

    /

    FUNCTION to CREATE or REPLACE f_emp RETURN t_emp_array

    is

    type rc_emp is ref cursor;

    r_emp rc_emp;

    v_emp_array t_emp_array: = t_emp_array();

    BEGIN

    R_emp OPEN for SELECT t_emp(ename,mgr,employee_id) FROM emp WHERE ROWNUM = 1;

    collect the fetch r_emp in bulk in v_emp_array;

    CLOSE R_emp;

    Return v_emp_array;

    exception

    while others then

    dbms_output.put_line (dbms_utility.format_error_stack);

    dbms_output.put_line (dbms_utility.format_call_stack);

    dbms_output.put_line (dbms_utility.format_error_backtrace);

    raise_application_error (-20001, SQLERRM);

    end;

    /

    SELECT *.

    table (f_emp ());

    a table function works with a table (nested table or varray)

    HTH

  • The assignment of values of Table type error

    Hello

    I'm trying to insert values for a Collection type, while doing that I am faced with an error.
    " PLS-00306: wrong number or types of arguments in call to
     'XXSCP_AVL_CSP_SQR_O_TP' "
    My statement of collection type PFB and and assignment.

    Object type:
    TYPE XXSCP_AVL_CSP_SQR_O_TP AS                  
    OBJECT  (                                       
                PLAN_ID             NUMBER,         
                SR_INSTANCE_ID      NUMBER,         
                INVENTORY_ITEM_ID   NUMBER,         
                BASE_ITEM_ID        NUMBER,              
                 ITEM_NAME           VARCHAR2(50),       
                 SUPPLIER_ID         NUMBER,             
                SUPPLIER_SITE_ID    NUMBER,         
                NORMAL_BUY_USAGE    VARCHAR2(5),    
                AVAILABLE_QUANTITY  NUMBER ,        
                SPL_PEG_FLAG        VARCHAR2(10),   
                SQR_LINE_ID         VARCHAR2(2000), 
                SQR_NUMBER          VARCHAR2(2000), 
                SQR_MOQ             NUMBER,         
                BPA_PO_LINE_ID      NUMBER,         
                SUGG_BPA_NUMBER     VARCHAR2(30),   
                BPA_BUY_PRICE_BASIS VARCHAR2(10),   
                BPA_LINE_NUM        NUMBER,         
                BPA_PO_LINE_LOC_ID  NUMBER,         
                BPA_CURRENCY_CODE   VARCHAR2(10),   
                BPA_PRICE           NUMBER,         
                BPA_PO_HEADER_ID    NUMBER,         
                BPA_EXPIRATION_DATE DATE,           
                BPA_QUANTITY        NUMBER,         
                ORIG_AVAILABLE_QTY  NUMBER          
            );        
    
    Table type :
    
    TYPE XXSCP_AVL_CSP_SQR_C_TP AS TABLE OF XXSCP_AVL_CSP_SQR_O_TP;
    Statement:
     l_tab_avl_csp_sqr   XXSCP_AVL_CSP_SQR_C_TP := XXSCP_AVL_CSP_SQR_C_TP();
    Assignment to the body:
    l_tab_avl_csp_sqr.EXTEND(1);
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT) := XXSCP_AVL_CSP_SQR_O_TP();
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).plan_id           := l_tab_planorders (i).l_num_plan_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sr_instance_id    := l_tab_planorders (i).l_num_sr_instance_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).inventory_item_id := l_tab_planorders (i).l_num_inventory_item_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).base_item_id      := l_tab_planorders (i).l_num_base_item_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).item_name         := l_tab_planorders (i).l_chr_item_name;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).supplier_id       := l_tab_planorders (i).l_num_supplier_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).supplier_site_id  := l_tab_planorders (i).l_num_supplier_site_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).available_quantity := l_rec_pegged_list (j).remaining_aval_qty;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).spl_peg_flag       := 'Y';
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_line_id        := l_rec_pegged_list (j).sqr_line_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_number         := l_rec_pegged_list (j).sqr_number;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_moq            := l_rec_pegged_list (j).sqr_moq;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_po_line_id     := l_rec_pegged_list (j).bpa_po_line_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sugg_bpa_number    := l_rec_pegged_list (j).bpa_number;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_buy_price_basis := l_rec_pegged_list (j).bpb_type;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_line_num        := l_rec_pegged_list (j).bpa_line_num;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_po_line_loc_id  := l_rec_pegged_list (j).bpa_lloc_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_currency_code   := l_rec_pegged_list (j).bpa_curr_code;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_price           := l_rec_pegged_list (j).bpa_price;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_expiration_date := l_rec_pegged_list (j).bpa_expiration_date ;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_quantity        := l_rec_pegged_list (j).bpa_quantity ;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).orig_available_qty  := l_rec_pegged_list (j).remaining_aval_qty ;
    Can anyone help with this.

    Thanks in advance,
    Rakesh

    Published by: Vincent Rakesh on April 24, 2013 12:18 AM

    You must add a vacuum-arg set constructor to your type to use, user l_tab_avl_csp_sqr (l_tab_avl_csp_sqr. "COUNTY): = XXSCP_AVL_CSP_SQR_O_TP();

    create or replace
    TYPE XXSCP_AVL_CSP_SQR_O_TP AS
    OBJECT  (
                PLAN_ID             NUMBER,
                SR_INSTANCE_ID      NUMBER,
                INVENTORY_ITEM_ID   NUMBER,
                BASE_ITEM_ID        NUMBER,
                 ITEM_NAME           VARCHAR2(50),
                 SUPPLIER_ID         NUMBER,
                SUPPLIER_SITE_ID    NUMBER,
                NORMAL_BUY_USAGE    VARCHAR2(5),
                AVAILABLE_QUANTITY  NUMBER ,
                SPL_PEG_FLAG        VARCHAR2(10),
                SQR_LINE_ID         VARCHAR2(2000),
                SQR_NUMBER          VARCHAR2(2000),
                SQR_MOQ             NUMBER,
                BPA_PO_LINE_ID      NUMBER,
                SUGG_BPA_NUMBER     VARCHAR2(30),
                BPA_BUY_PRICE_BASIS VARCHAR2(10),
                BPA_LINE_NUM        NUMBER,
                BPA_PO_LINE_LOC_ID  NUMBER,
                BPA_CURRENCY_CODE   VARCHAR2(10),
                BPA_PRICE           NUMBER,
                BPA_PO_HEADER_ID    NUMBER,
                BPA_EXPIRATION_DATE DATE,
                BPA_QUANTITY        NUMBER,
                ORIG_AVAILABLE_QTY  NUMBER,
    /*
    Constructor
    */
                constructor function XXSCP_AVL_CSP_SQR_O_TP return self as result
            );        
    
    create or replace
    TYPE body XXSCP_AVL_CSP_SQR_O_TP AS
    /*
    Constructor
    */
                constructor function XXSCP_AVL_CSP_SQR_O_TP return self as result
                is
                begin
                  return;
                end;
    end;        
    

    You can also assign your attributes that you construct your instance:

    l_tab_avl_csp_sqr.EXTEND(1);
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT) := new XXSCP_AVL_CSP_SQR_O_TP(
      l_tab_planorders (i).l_num_plan_id,
      l_tab_planorders (i).l_num_sr_instance_id.
      l_tab_planorders (i).l_num_inventory_item_id,
      l_tab_planorders (i).l_num_base_item_id,
      l_tab_planorders (i).l_chr_item_name,
      l_tab_planorders (i).l_num_supplier_id,
      l_tab_planorders (i).l_num_supplier_site_id,
      l_rec_pegged_list (j).remaining_aval_qty,
      'Y',
      l_rec_pegged_list (j).sqr_line_id,
      l_rec_pegged_list (j).sqr_number,
      l_rec_pegged_list (j).sqr_moq,
      l_rec_pegged_list (j).bpa_po_line_id,
      l_rec_pegged_list (j).bpa_number,
      l_rec_pegged_list (j).bpb_type,
      l_rec_pegged_list (j).bpa_line_num,
      l_rec_pegged_list (j).bpa_lloc_id,
      l_rec_pegged_list (j).bpa_curr_code,
      l_rec_pegged_list (j).bpa_price,
      l_rec_pegged_list (j).bpa_expiration_date,
      l_rec_pegged_list (j).bpa_quantity,
      l_rec_pegged_list (j).remaining_aval_qty );
    

    Gerard

    Published by: gaverill on April 23, 2013 12:12

  • Pre-defined types of Oracle nested table

    Hello
    I am in the Internet search and could not find one of the pre-defined types of nested table in Oracle. For example: a type that can contain strings. Can anyone put here a few names of this type?
    create table mytable (id integer, theList sys.odcivarchar2list);
    
    insert into mytable (id, thelist)
    values ( 1, sys.odcivarchar2list('a','b','c'));
    
  • create table as a table with nested column type

    On my Oracle DB (11.1), I have a table with a nested as a column type (and it is a partitioned table).
    Now I need to copy partitions in a second table, and I use swap partition for it (with a table that is not partitioned as a table in step).

    But there is a problem, because as the ordinary as sql ddl:
    create table table1_stage as select * from table1 where 1=2;
    does not work when there is a table nested within a column type.
    Is it possible easy to copy its structure (and to create the table that is not partitioned, so I suppose that no dbms_metadata package would help)?


    Kind regards...

    >
    does not work when there is a table nested within a column type.
    >

    Will work indeed.

    Read this

    SQL> CREATE TYPE typtst IS TABLE OF VARCHAR2 (100);
      2
      3  /
    
    Type created.
    
    SQL> CREATE TABLE test1
      2  (
      3     col1   VARCHAR2 (100),
      4     col2   typtst
      5  )
      6  NESTED TABLE col2
      7     STORE AS list1;
    
    Table created.
    
    SQL> CREATE TABLE test2
      2  NESTED TABLE col2
      3     STORE AS list2
      4  AS
      5     SELECT * FROM test1;
    
    Table created.
    
    SQL> 
    

    G.

  • 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.

  • What is the preferred means of data transmission as a type of record between the nested table of pl/sql program or an associative array

    What is the preferred means of data transmission in the associative array of the nested table record vs

    Choose between Nested Tables and associative arrays

    The two nested tables and associative arrays (formerly index - by tables) use similar index notation, but they have different characteristics when it comes to persistence and ease of passing parameters.

    Nested tables can be stored in a column of data, but can of associative arrays. Nested tables can simplify the SQL operations where you would normally join a single-column table with a larger table.

    Associative arrays are appropriate for relatively small lookup tables where the collection can be constructed in memory whenever a procedure is called or a package is initialized. They are good for the collection of the information volume is unknown beforehand, because there is no fixed limit on their size. Their index values are more flexible, as associative array indices can be negative, can be no sequential and can use values of string instead of numbers.

    PL/SQL automatically converts between the bays of the host and the associative arrays that use values of digital keys. The most effective way to move the collections to and from the database server is to implement data values in associative arrays, and then use these associative arrays with erections in bulk (the FORALL statement or BULK COLLECT clause).

    With the help of documents and Collections of PL/SQL

    Read this:

    How to pass the record set as a parameter of the procedure.

    https://community.Oracle.com/thread/2375173?TSTART=0

  • Compare the content of two equal nested tables

    I'm working on a black box test where I compare the contents of two structurally equal tables before and after executing a script of some. My two tables, MDQ_OLD and MDQ_NEW, are filled with the data in two separate operations.

    The two tables, I'll compare are nested, as you can see in the CREATE TABLE scripts below.

    I tried to use the less-operator sign, but without success.

    I also tried to select data in a type that is % ROWTYPE to my nested tables, but it does not work as well (see the below script in this post).

    Can you please help me on this problem on how to compare the content of two nested tables?

    Run the scripts below to reproduce the problem and be sure to update this post if more information is required.

    -The scripts below-

    Select * from version of v$.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    PL/SQL Release 11.2.0.4.0 - Production

    CORE Production 11.2.0.4.0

    AMT for Linux: Version 11.2.0.4.0 - Production

    NLSRTL Version 11.2.0.4.0 - Production

    -First of all, I create my types

    CREATE OR REPLACE TYPE FORCE AS OBJECT MDQ_DETAIL (NUMBER OF MDQ_DETAIL_ID, MDQ_DETAIL_DESC VARCHAR2 (100));

    CREATE OR REPLACE TYPE T_MDQ_DETAIL AS TABLE MDQ_DETAIL;

    -Note that this type contains the table T_MDQ_DETAIL type:

    CREATE OR REPLACE TYPE MDQ_PARENT FORCE AS OBJECT (NUMBER MDQ_ID, MDQ_DETAILS T_MDQ_DETAIL);

    - Then I create two equal nested tables

    CREATE THE NESTED TABLE AS MDQ_PR_OLD STORE MDQ_DETAILS MDQ_PARENT MDQ_OLD TABLE.

    CREATE THE NESTED TABLE AS MDQ_PR_NEW STORE MDQ_DETAILS MDQ_PARENT MDQ_NEW TABLE.

    -Insert test data in the nested tables

    Insert into MDQ_OLD (MDQ_ID, MDQ_DETAILS) Values (1, T_MDQ_DETAIL (MDQ_DETAIL(1,'desc1')));

    Insert into MDQ_NEW (MDQ_ID, MDQ_DETAILS) Values (2, T_MDQ_DETAIL (MDQ_DETAIL(1,'desc1')));

    -Try to use the negative operator to compare the contents of the trailer of the nested tables, but it gives this error:

    -ORA-00932: inconsistent data types: expected - got DISPATCH. T_MDQ_DETAIL

    Select * from MDQ_NEW

    less

    Select * from MDQ_OLD;

    -Try to select in a ROWTYPE, but it fails

    declare

    myTypeOld MDQ_OLD % ROWTYPE;

    myTypeNew MDQ_New % ROWTYPE;

    myTypeDiff MDQ_New % ROWTYPE;

    Start

    -Select gives: PLS-00497: do not mix between row and several rows (in BULK) list

    Select * bulk collect into mdq_old myTypeOld;

    Select * bulk collect into mdq_new myTypeNew;

    -Need a 'compare the function of membership card' on the types of multiset except to work, but as far as I

    -I'm not able to bulk collect into myTypeOld or myTypeNew, this won't help out me.

    myTypeDiff: = multiset myTypeOld except myTypeNew.

    end;

    -Cleaning:

    drop table MDQ_OLD;

    drop table MDQ_NEW;

    type of projection MDQ_PARENT;

    type of projection T_MDQ_DETAIL;

    type of projection MDQ_DETAIL;

    > queries you provided intercepts not who.

    You asked how to compare the content of nested tables.

    I knew that you didn't ask for what you actually want, that's why I asked you to specify the comparison more in detail.

    > Do you have a query that grabs this difference as well?

    SELECT o.mdq_id, od.*
    OF mdq_old o, TABLE (o.mdq_details) od
    LESS
    SELECT n.mdq_id, nd.*
    OF mdq_new n, TABLE (n.mdq_details) nd;

    > Also, if possible, do you have a sample of a statement to COLLECT LOOSE, please?

    Actually, you raise an interesting point on using % ROWTYPE, in my view, that should be. This make...

    DECLARE
    TYPE rt_mdq_new () IS RENDERING
    mdq_id NUMBER,
    mdq_details t_mdq_detail);
         
    TYPE tt_mdq_new IS TABLE OF THE rt_mdq_new;
      
    t_mdq_new tt_mdq_new;
    BEGIN
    SELECT mdq_id, mdq_details
    LOOSE COLLECTION t_mdq_new
    OF mdq_new min.;
    END;
    /

    DECLARE
    CURSOR c_mdq_new
    IS
    SELECT mn.*
    OF mdq_new min.;
         
    TYPE tt_mdq_new IS TABLE OF c_mdq_new % ROWTYPE;
      
    t_mdq_new tt_mdq_new;
    BEGIN
    OPEN c_mdq_new.
    Get the c_mdq_new COLLECT in BULK IN t_mdq_new;
    CLOSE C_mdq_new;
    END;
    /

  • Inserting data in the nested table

    I explore the differences between the OBJECT and RECORD.

    As I'm still learning, I found that both are structures which essentially brings together different elements of types of different data or columns of data types, one is used in SQL and other is used in PL/SQL, please correct me if I'm wrong in my understanding.

    Below, I am trying to insert data into an array of type object, but I can't can you please help.

    CREATE OR REPLACE type sam as OBJECT
    (
    v1 NUMBER,
    v2 VARCHAR2(20 CHAR)
    );
    
    ---Nested Table---
    create or replace type t_sam as table of sam;
    
    --Inserting data----
    insert into table(t_sam) values(sam(10,'Dsouza'));
    

    Error message:

    Error starting at line 22 in command:
    insert into table(t_sam) values(sam(10,'Dsouza'))
    Error at Command Line:22 Column:13
    Error report:
    SQL Error: ORA-00903: invalid table name
    00903. 00000 -  "invalid table name"
    *Cause:    
    *Action:
    

    Ariean wrote:

    So the only purpose of the equivalent concept of SQL types of nested tables is to use one of the data types when you define an actual table?

    So-you can certainly use more that a simple "set an actual table. (I'm fairly certain that you can pass a table nested within a procedure, for example - try it, though - I'm not 100% sure on that - it just 'logic'.) If you can define a type, you can use it, pass it around, whatever.).

    Ariean wrote:

    And this nested table could be a record in SQL or object in PLSQL or simple data type (varchar number, etc.)?

    Nested tables are just like any other type of custom data. You can create a nested table of other types of data. You can create a custom of nested tables data type.

    Stupidly, he could become... uh, stupid O_0

    CREATE TYPE o_myobj1 AS object ( id1   number, cdate1  date );
    
    CREATE TYPE t_mytype1 AS table of o_myobj1;
    
    CREATE TYPE o_myobj2 AS object ( id2   number,  dumb  t_mytype1 );
    
    CREATE TYPE t_dumber AS table of o_myobj2;
    

    O_0

    OK, my brain is starting to hurt - I hope you get the idea

    Ariean wrote:

    Second is my understanding correct any OBJECT & RECORD?

    I see no benefit to describe another way.

Maybe you are looking for

  • Cannot download FaceTime

    I have tried to FaceTime for the first time on my laptop but keep getting this message: "Failed to install FaceTime on"Macintosh HD"because the version of Mac OS X is too recent."  I can do or should I expect that Apple will update FaceTime?  Help.

  • Satellite U300-130 - TosBtMng has stopped working after installing Nokia PC Suite

    I have the same problem too... with Toshiba Satellite U300-130. Bluetooth worked well enough before I installed the Nokia PC Suite for my mobile on my PC (new version 7.1.26.0 Web site). To be correct, as a first step, I even managed to maintain a co

  • Unexpected error

    I'm trying to set up my printer in the eprintcenter.com.  I tried to enter the code that has been just printede an hour ago both my iPhone and my computer.  I get "unexpected error." I wanted to just one person talk to him live but the HP Customer Se

  • Lost bootcamp partition

    As he tried to resize my partition bootcamp (and then removal of partition of the said) my worked before Windows partition will be is no longer visible on the startup disk selection screen. I read through some forums for similar problems, but none of

  • my monitor does not automatically open on a startup computer or after sleep.

    MY MONITOR DOES NOT OPEN AUTOMATICALLY ON A BOOT UP OR AFTER SLEEP.  I HAVE TO CLOSE THE MARKET TO DO WORK. HE DID THIS FOR A FEW WEEKS.  THIS IS AN OLD 20 "AL2017 MONITOR.  JAKE