[Newbie] Basic nested table creation

Hi there.
I've got a basic scheme here. First, I've got a type called Student, with various attributes. I've also got a type Degree, which holds a nested table of Students. I'm trying to implement it like this:
CREATE OR REPLACE TYPE Student_type AS OBJECT(
Name VARCHAR2(20),
Degree REF Degree_type
CREARE OR REPLACE TYPE Students_NT AS TABLE OF Student_type;
CREATE OR REPLACE TYPE Degree_type AS OBJECT(
Name VARCHAR2(20),
Students Student_NT
Looks like there's a circular dependency here, how can I solve it? I've thought I tried adding the attributes of the relation (the reference in Student_type and the nested table in the Degree_type) afterwards by altering the types, but it does not work.
What can I do? Thanks in advance.

Hi,
You need to create DEGREE_TYPE as an incomplete type first, as explained in the documentation :
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14260/adobjmng.htm#ADOBJ00402
So in your case :
CREATE TYPE Degree_type;
CREATE OR REPLACE TYPE Student_type AS OBJECT(
Name VARCHAR2(20),
Degree REF Degree_type
CREATE OR REPLACE TYPE Students_NT AS TABLE OF Student_type;
CREATE OR REPLACE TYPE Degree_type AS OBJECT(
Name VARCHAR2(20),
Students Students_NT
/

Similar Messages

  • Problem in creation of Nested Table

    Hi Everyone,
    I have applied thisexample for creating nested tables but at the end I got the message of invalid datatype
    current_address full_mailing_address_type,
    ERROR at line 4:
    ORA-00902: invalid datatype
    http://www.praetoriate.com/oracle_tips_nested_tables.htm
    Please help me out.....
    Message was edited by:
    Dharmendra

    What is the output for
    select * from user_types
    ?

  • Problem in creating a nested table

    Hi i am working on Oracle 10g and cleint is sqlplus.
    Now while creating a nested table following error occured.
    This is the script for your reference.:
    CREATE OR REPLACE TYPE sec_pwd_hist_table
    AS
    TABLE OF sec_pwd_history_type
    index by binary_integer
    Warning: Type created with compilation errors.
    SQL> show error
    Errors for TYPE SEC_PWD_HIST_TABLE:
    LINE/COL ERROR
    0/0      PL/SQL: Compilation unit analysis terminated
    3/1      PLS-00355: use of pl/sql table not allowed in this context
    Please help on this issue
    Regards,
    Vikas Kumar

    > but i want to know just one thing why its working when i am removing "INDEX BY binaty_integer"
    Vikas, I trust I answered that question when I said? :
    "Do not confuse the two. Do not attempt to use PL/SQL array struct definition syntax in the SQL engine for defining an ADT collection. Which is why I referred you to the manual to see how an ADT is defined in SQL."
    In other words, you are trying to apply a PL/SQL concept and PL/SQL syntax to a definition of a data type in SQL.
    SQL is not PL/SQL.
    SQL ADTs are not PL/SQL arrays/tables.
    It is not even a syntax issue - it is a basic concept issue. SQL does not support PL/SQL arrays/tables. Period.

  • How to insert into a table with a nested table which refer to another table

    Hello everybody,
    As the title of this thread might not be very understandable, I'm going to explain it :
    In a context of a library, I have an object table about Book, and an object table about Subscriber.
    In the table Subscriber, I have a nested table modeling the Loan made by the subscriber.
    And finally, this nested table refers to the Book table.
    Here the code concerning the creation of theses tables :
    Book :
    create or replace type TBook as object
    number int,
    title varchar2(50)
    Loan :
    create or replace type TLoan as object
    book ref TBook,
    loaning_date date
    create or replace type NTLoan as table of TLoan;
    Subscriber :
    create or replace type TSubscriber as object
    sub_id int,
    name varchar2(25)
    loans NTLoan
    Now, my problem is how to insert into a table of TSubscriber... I tried this query, without any success...
    insert into OSubscriber values
    *(1, 'LEVEQUE', NTLoan(*
    select TLoan(ref(b), '10/03/85') from OBook b where b.number = 1)
    Of course, there is an occurrence of book in the table OBook with the number attribute 1.
    Oracle returned me this error :
    SQL error : ORA-00936: missing expression
    00936. 00000 - "missing expression"
    Thank you for your help

    1) NUMBER is a reserved word - you can't use it as identifier:
    SQL> create or replace type TBook as object
      2  (
      3  number int,
      4  title varchar2(50)
      5  );
      6  /
    Warning: Type created with compilation errors.
    SQL> show err
    Errors for TYPE TBOOK:
    LINE/COL ERROR
    0/0      PL/SQL: Compilation unit analysis terminated
    3/1      PLS-00330: invalid use of type name or subtype name2) Subquery must be enclosed in parenthesis:
    SQL> create table OSubscriber of TSubscriber
      2  nested table loans store as loans
      3  /
    Table created.
    SQL> create table OBook of TBook
      2  /
    Table created.
    SQL> insert
      2    into OBook
      3    values(
      4           1,
      5           'No Title'
      6          )
      7  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> insert into OSubscriber
      2    values(
      3           1,
      4           'LEVEQUE',
      5           NTLoan(
      6                  (select TLoan(ref(b),DATE '1985-10-03') from OBook b where b.num = 1)
      7                 )
      8          )
      9  /
    1 row created.
    SQL> select  *
      2    from  OSubscriber
      3  /
        SUB_ID NAME
    LOANS(BOOK, LOANING_DATE)
             1 LEVEQUE
    NTLOAN(TLOAN(000022020863025C8D48614D708DB5CD98524013DC88599E34C3D34E9B9DBA1418E49F1EB2, '03-OCT-85'))
    SQL> SY.

  • Inserting Data into nested table

    I am exploring the differences between OBJECT & RECORD.
    As i am still in process of learning, I found that both are structures which basically groups elements of different datatypes or columns of different datatypes, one is used in SQL and other is used in PL/SQL, please correct me if I am wrong in my understanding.
    Below i am trying to insert data into an table of type object but i am unsuccessful 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 only purpose of equivalent SQL types concept of nested tables is to use them as one of the data types while defining an actual table?
    Sort of - you can definitely use them for more than just "defining an actual table". (I'm fairly certain you could pass a nested table into a procedure, for example - try it, though - I'm not 100% sure on that - it just "makes sense". If you can define a type, you can use it, pass it around, whatever.).
    Ariean wrote:
    And that nested table could be a record in SQL or an Object in PLSQL or just simple datatype(number,varchar etc)?
    Nested tables are just like any other custom data type. You can create a nested table of other data types. You can create a custom data type of nested tables.
    It could get stupidly .. er, 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's starting to hurt - I hope you get the idea
    Ariean wrote:
    Secondly is my understanding correct about OBJECT & RECORD?
    I can't think of any benefit of describing it another way.

  • Error while mapping two times nested table

    Hi,
    I have a Product table which has nested ProductSubcategory in it.
    ProductSubcategory nested table also has nested table ProductCategory inside it.
    So there is a nested table inside nested table.
    I designed a dimension on warehoue builder and while mapping, i got "ORA-22913: must specify table name for nested table column or attribute" error.
    I mapped nested tables before with using varray iterator and expand object, but they were nested once. Is there any solution for mapping two or more time nested tables?
    Now i exracted tables and i continuou working but, i wondered is there any way.
    Creation codes are below. Thanx :)
    CREATE TABLE PRODUCT
    (     PRODUCTID NUMBER NOT NULL ,
         ProductSubcategory ProductSubcategory,
         MODIFIEDDATE DATE NOT NULL)
    NESTED TABLE ProductSubcategory STORE AS ProductSubcategory_TABLE
    ( NESTED TABLE ProductCategoryId STORE AS ProductCategory_TABLE);
    CREATE TYPE TYPE_ProductSubcategory AS OBJECT (
         ProductSubcategoryID number ,
         ProductCategoryId ProductCategory ,
         Name Varchar(50) ,
         rowguid varchar2(100) ,
         ModifiedDate date );
    CREATE TYPE TYPE_ProductCategory AS OBJECT (
         ProductCategoryID number ,
         Name Varchar(50) ,
         rowguid varchar2(100) ,
         ModifiedDate date );

    Bharadwaj Hari wrote:
    Hi,
    I agree with u...I am not sure of the environment the user has so i put forth all the 3 option that crossed my mind that time....thats why i said he has to choose what best suits him/her...
    Also if the database is huge and we create physical temp tables (option 2 and ur idea) its like having redundant data in the database which is also a problem....So ist upto the user to actually evaluate the situation and come up with what best suits him/her...
    Regards
    BharathHi,
    I understand your opinion. But I am not sure that the user have enough experience to choose the best option by his one. And about the redundant data: because of this I wrote that he should truncate the tables after the last mapping which loads all data into the real target table.
    Regards,
    Detlef

  • IN operator in nested tables

    Hi,
    Does anyone can redo an IN operator in nested tables example?
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28371/adobjcol.htm#sthref396
    My example returns no row...
    CREATE TYPE Pilote_elt_nt_type AS OBJECT
    (brevet VARCHAR(4), nomPil VARCHAR(15),
    MAP MEMBER FUNCTION get_brevet RETURN VARCHAR)
    CREATE TYPE BODY Pilote_elt_nt_type AS
    MAP MEMBER FUNCTION get_brevet RETURN VARCHAR IS
    BEGIN
    RETURN brevet;
    END get_brevet ;
    END;
    CREATE TYPE Pilotes_nt_type AS TABLE OF Pilote_elt_nt_type
    CREATE TABLE Compagnie
    (numComp VARCHAR2(2) PRIMARY KEY,
    nomComp VARCHAR2(20),
    commandants_nt Pilotes_nt_type,
    instructeurs_nt Pilotes_nt_type,
    pilotes_nt Pilotes_nt_type)
    NESTED TABLE commandants_nt STORE AS commandants_tabnt
    NESTED TABLE instructeurs_nt STORE AS instructeurs_tabnt
    NESTED TABLE pilotes_nt STORE AS pilotes_tabnt;
    INSERT INTO Compagnie
    VALUES ('C1','Air France',
    Pilotes_nt_type (
              Pilote_elt_nt_type ('PL-1','C. Sigaudes'),
    Pilote_elt_nt_type ('PL-3','A. Bidal'),
    Pilote_elt_nt_type ('PL-2','S. Payrissat')
    Pilotes_nt_type (
              Pilote_elt_nt_type ('PL-2','S. Payrissat')
    Pilotes_nt_type (          
    Pilote_elt_nt_type ('PL-3','A. Bidal'),
    Pilote_elt_nt_type ('PL-1','C. Sigaudes'),
              Pilote_elt_nt_type ('PL-4','F. Périssel')) );
    SELECT p.nomPil
    FROM Compagnie, TABLE(commandants_nt) p;
    SELECT p.nomPil
    FROM Compagnie, TABLE(instructeurs_nt) p;
    SELECT p.nomPil
    FROM Compagnie, TABLE(pilotes_nt ) p;
    --no row !
    SELECT p.nomPil
    FROM Compagnie, TABLE(commandants_nt) p
    WHERE commandants_nt IN (pilotes_nt,instructeurs_nt);

    Actually, my general advices are not my original advices, but (mostly) C.J.Date's advices.
    I'm IT practitioner (not IT scientists), but I highly appreciate work (theoretical and practical) of IT scientists like
    Edsger W.Dijkstra, C.Antony.R Hoare, John W.Backus, Peter Naur, Ole-Johan Dahl, Kristen Nygaard, Donald E.Knuth,
    Niklaus E.Wirth, Alan C.Kay, Edgar F.Codd, Christopher J.Date, Bertrand Meyer ... and many more.
    I like OOPL's, especially Eiffel. But mostly I like relational model and relational DBMS's.
    My motto is: “Thou shall not do in the Middle Tier, what thou could have done in the Data Tier”
    (Toon Koppelaars in "A first JDeveloper project: Choices made, lessons learned", Oracle World 2002).
    First, I don't like to use REF's in Oracle (relational) DBMS.
    C.J.Date in "An introduction to Database Systems" (eighth edition, 2004, chapter 26) says:
    - "The Second Great Blunder consists of mixing pointers [REF's] and relations"
    - "The Second Great Blunder undermines the conceptual integrity of the relational model in numerous ways"
    Second, using nested tables in relational database is "legal". In the same book (page 373) Date says:
    "... it is possible for a relation to include an attribute whose values are relations in turn...
    Historically, in fact, such relvars [relation variables] were not even legal -
    they were said to be unnormalized, meaning they were not even regarded as being in 1NF".
    But, note that on the same page Date says:
    "From the point of view of database design, however, such relvars are usually contraindicated,
    because they tend to be asymmetric ... and such asymmetry can lead to various practical problems".
    So, we can use nested tables (relational-valued attributes), but very very sparingly, and I agree with Billy (Verreynne):
    I also think this design of yours (using nested tables instead of normal relational tables) it a very much flawed approach. Third, I use object types as domains. In the same book (page 885) Date says:
    "... object/relational systems ... are, or should be, basically just relational systems that support the relational domain concept (i.e., types) properly
    - in other words, true relational systems, meaning in particular systems that allow users to define their own types".
    Here is my attempt to use Oracle "object-relational" features "in the proper way" (in Date's sense) - to use object type as domain:
    “OR(DBMS) or R(DBMS), That is the Question”
    http://www.quest-pipelines.com/pipelines/plsql/tips.htm#OCTOBER
    Date says that "The First Great Blunder" is to equate object classes and relational variables,
    simply speaking - to have object tables (tables in which each row represents an object).
    I must say that I'm not 100% sure about "The First Great Blunder" in Oracle (see Re: to REF or not to REF? or Re: difference between value and deref clause in oop).
    Date says that one consequence of "The First Great Blunder" is to have subtables and supertables.
    Subtables and supertables exists in SQL:1999 standard. But, in Oracle we can't say (SQL:1999 syntax):
    CREATE TABLE programmer_obj_tab OF programmer_type UNDER emp_obj_tab;
    Oracle hasn't (explicit) subtables and supertables.
    I recommend to you Billy's threads - you can find many excellent advices and opinions.
    Regards,
    Zlatko

  • Data pump import error with nested tables

    So the problem is somewhat long :)
    Actually the problems are two - why and how oracle are treating OO concept and why data pump doesn't work?
    So scenario for the 1st one:
    1) there is object type h1 and table of h1
    2) there is unrelated object type row_text and table of row_text
    3) there is object type h2 under h1 with attribute as table of row_text
    4) there is table tab1 with column b with data type as table of h1. Of course column b is stored as nested table.
    So how do you think - how many nested tables Oracle will create? The correct answer is 2. One explicitly defined and one hidden with system
    generated name for the type h2 which is under type h1. So the question is WHY? Why if I create an instance of supertype Oracle tries to adapt
    it for the subtype as well? Even more if I create another subtype h3 under h1 another hidden nested table appears.
    This was the first part.
    The second part is - if I do schema export and try to import it in another schema I got error saying that oracle failed to create storage table for
    nested table column b. So the second question is - if Oracle has created such a mess with hidden nested tables how to import/export to another
    schema?
    Ok and here is test case to demonstrate problems above:
    -- creating type h1 and table of it
    SQL> create or replace type h1 as object (a number)
      2  not final;
      3  /
    Type created.
    SQL> create or replace type tbl_h1 as table of h1;
      2  /
    Type created.
    -- creating type row_text and table of it
    SQL> create or replace type row_text as object (
      2    txt varchar2(100))
      3  not final;
      4  /
    Type created.
    SQL> create or replace type tbl_row_text as table of row_text;
      2  /
    Type created.
    -- creating type h2 as subtype of h1
    SQL> create or replace type h2 under h1 (some_texts tbl_row_text);
      2  /
    Type created.
    SQL> create table tab1 (a number, b tbl_h1)
      2  nested table b
      3  store as tab1_nested;
    Table created.
    -- so we have 2 nested tables now
    SQL> select table_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    TABLE_NAME                     PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    SYSNTfsl/+pzu3+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
    TAB1_NESTED                    TAB1
    B
    -- another subtype of t1
    SQL> create or replace type h3 under h1 (some_texts tbl_row_text);
      2  /
    Type created.
    -- plus another nested table
    SQL> select table_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    TABLE_NAME                     PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    SYSNTfsl/+pzu3+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"
    SYSNTfsl/+pz03+jgQAB/AQB27g==  TAB1_NESTED
    TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"
    TAB1_NESTED                    TAB1
    B
    SQL> desc "SYSNTfsl/+pzu3+jgQAB/AQB27g=="
    Name                                      Null?    Type
    TXT                                                VARCHAR2(100)OK let it be and now I'm trying to export and import in another schema:
    [oracle@xxx]$ expdp gints/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints.log
    Export: Release 11.2.0.1.0 - Production on Thu Feb 4 22:32:48 2010
    <irrelevant rows skipped>
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    . . exported "GINTS"."TAB1"                                  0 KB       0 rows
    . . exported "GINTS"."SYSNTfsl/+pz03+jgQAB/AQB27g=="         0 KB       0 rows
    . . exported "GINTS"."TAB1_NESTED"                           0 KB       0 rows
    . . exported "GINTS"."SYSNTfsl/+pzu3+jgQAB/AQB27g=="         0 KB       0 rows
    Master table "GINTS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    ******************************************************************************And now import. In order to create types transformation of OIDs is applied and also remap_schema
    Although it fails to create the table.
    [oracle@xxx]$ impdp gints1/xxx@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
    Import: Release 11.2.0.1.0 - Production on Thu Feb 4 22:41:48 2010
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Release 11.2.0.1.0 - Production
    Master table "GINTS1"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "GINTS1"."SYS_IMPORT_FULL_01":  gints1/********@xxx directory=xxx dumpfile=gints.dmp logfile=gints_imp.log remap_schema=gints:gints1 transform=OID:n
    Processing object type SCHEMA_EXPORT/USER
    ORA-31684: Object type USER:"GINTS1" already exists
    Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
    Processing object type SCHEMA_EXPORT/ROLE_GRANT
    Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    ORA-39083: Object type TABLE:"GINTS1"."TAB1" failed to create with error:
    ORA-02320: failure in creating storage table for nested table column B
    ORA-00904: : invalid identifier
    Failing sql is:
    CREATE TABLE "GINTS1"."TAB1" ("A" NUMBER, "B" "GINTS1"."TBL_H1" ) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE I_N VARCHAR2(60);   I_O VARCHAR2(60);   c DBMS_METADATA.T_VAR_COLL;   df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN  DELETE FROM "SYS"."IMPDP_STATS";   c(1) :=   DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H2")."SOME_TEXTS"',1);  DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n);   INSERT INTO "
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE I_N VARCHAR2(60);   I_O VARCHAR2(60);   c DBMS_METADATA.T_VAR_COLL;   df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS'; BEGIN  DELETE FROM "SYS"."IMPDP_STATS";   c(1) :=   DBMS_METADATA.GET_STAT_COLNAME('GINTS1','TAB1_NESTED',NULL,'TREAT(SYS_NC_ROWINFO$ AS "GINTS"."H3")."SOME_TEXTS"',1);  DBMS_METADATA.GET_STAT_INDNAME('GINTS1','TAB1_NESTED',c,1,i_o,i_n);   INSERT INTO "
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    Job "GINTS1"."SYS_IMPORT_FULL_01" completed with 4 error(s) at 22:41:52So any idea how to make export/import of such tables?
    TIA
    Gints

    Tom Kyte has said it repeatedly ... I will repeat it here for you.
    The fact that Oracle allows you to build object tables is not an indication that you should.
    Store your data relationally and build object_views on top of them.
    http://www.morganslibrary.org/reference/object_views.html
    If you model properly, and store properly, you don' have any issues.

  • Nested tables won't allign with primary table

    Hello all. It looks like I’m faced with another
    table-related obstacle. While I was creating one of my inner pages,
    I’ve utilized nested tables to create a column on the left
    hand side of the page that will hold my secondary menu, while the
    other column will hold a flash element and page content.
    Although I’ve inserted all nested tables with
    “0” cell spacing and “0” cell padding, and
    the visual aids seem to suggest that the values of the nested table
    are identical with the primary table that holds them, the nested
    table that will hold the movie and page content isn’t flush
    with the table above. It seems to be off only by 1-2 pixels or so,
    but since there will be an image right underneath the menu this is
    quite obvious.
    I have attached the code for your information (line 165,
    166).
    Thank you for your time and suggestions. I really appreciate
    it.

    On Sat, 16 Sep 2006 15:06:50 +0000 (UTC), "HTML-Newbie"
    <[email protected]> wrote:
    > Check out the link
    http://www.fastventures.com/dev/test_temp_2col.html
    and you
    >will see that the picture underneath the main menu won't
    line up with it on the
    >right-hand side.
    Change this:
    <table width="572" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td height="200" valign="top"><img
    src="img/place_second.jpg" width="572"
    height="200"></td>
    </tr>
    To this:
    <table width="572" border="0" cellspacing="0"
    cellpadding="0"
    align="right">
    <tr>
    <td height="200" valign="top"><img
    src="img/place_second.jpg" width="572"
    height="200"></td>
    </tr>
    Gary

  • Why on earth use nested tables?

    Hi
    I'm boning up on PL/SQL (again) in anticipation of getting a new job.
    I have many years of experience in various data-related roles, many of which used Oracle.
    On the issue of collections, I find myself asking, in the light of my experience, and not for the first time, why on earth would anyone want to do this:
    create or replace type TEST_TT as table of varchar2(10);
    create table TEST_TABLE ( X number
                             ,Y test_tt)
                             nested table Y store as Y_TABLE;                      I really, really, can't think why we would want to store data like this. It seems to me to be unnecessarily complex, hiding a one-to-many relationship inside TEST_TABLE, which should instead be modelled and implemented as a separate table.
    Furthermore, there are loads of tutorials on collections that tell us how to do the above (indeed I am reading Feuerstein at this very time) but nobody seems to say WHY we should do this.
    Can anybody help me here?
    Thanks.
    Jason

    >
    I'm boning up on PL/SQL (again) in anticipation of getting a new job.
    I have many years of experience in various data-related roles, many of which used Oracle.
    On the issue of collections, I find myself asking, in the light of my experience, and not for the first time, why on earth would anyone want to do this:
    I really, really, can't think why we would want to store data like this. It seems to me to be unnecessarily complex, hiding a one-to-many relationship inside TEST_TABLE, which should instead be modelled and implemented as a separate table.
    Furthermore, there are loads of tutorials on collections that tell us how to do the above (indeed I am reading Feuerstein at this very time) but nobody seems to say WHY we should do this.
    >
    For As you have surmised, just because you CAN do it doesn't mean you SHOULD do it. If you are only working with your standard relational data, such as the example you provide, it has many drawbacks and few, if any advantages.
    It is easier to understand why that capability exists from the viewpoint of the question: why SHOULDN'T you be able to store data like that?
    In one sense it is just another object-oriented feature. You can create object types and pass them around to procedure/functions or external processes (e.g. JDBC) so why shouldn't you be able to store that set of related data as an encapsulated object?
    Why do you need an object type that has a set of columns? You can just as easily put those columns into a table. But how do you manipulate a subset of the columns or rows of a table? How do you pass that data around as a controlled, coherant set of data? You can't.
    With an object type you can, though most often don't, implement encapsulated business rules that ensure that any instance of that type MUST implement. Need ADDRESS information that is required to include a street address, city, state and zip? Create an object type with the right constructor methods and you can ensure that those attributes CANNOT be null.
    Once you have functionality to create and manipulate objects why not be able to pass those objects around and stored them in a table? Doesn't mean you should always store them that way but why not be able to? There isn't any reason to limit that functionality simply because you don't think it is the best practice to use it all the time.
    So if you have a small dataset and want all of that data to 'travel' together nest it. There is no child table to create or foreign key to create.
    I put that functionality in the category of CAN DO but DON'T DO except in rare occasions and consider it a fallout of the move to object-oriented things in general. I like the fact that Oracle makes functionilty like that available when they have it.
    Like dynamic sql, materializeds views, bitmap indexes and much other functionality it is often more important to know when NOT to use it than it is to know when to use it.
    Relative to 'best practices' of why NOT to do that for your basic relational data see this part of the article that Justin referred you to:
    >
    Followup March 3, 2003 - 6am Central time zone:
    1) they are parent child tables in disguise but ones that add:
    a 16 byte raw with a unique constraint on the parent table. Most likely you ALREADY HAVE a primary
    key on the parent table and most likely it is smaller.
    a 16 byte raw that you need to index on the child (not auto-indexed, you need to know to do it).
    This is the foreign key and is hidden from you.
    The inability to put many types of constraints on the nested table..
    They are simple parent/child tables - except you lose the ability to access the child table
    directly.
    2) you are NOT storing anything in a "single row". Physically they are a parent child table pair,
    nothing more, nothing less
    If you have my book "Expert one on one Oracle" - I write about them in there, describe their
    implementation and talk about when I would use them.

  • How to cast RECORD of nested tables into OBJECT of nested tables

    Right, we have an existing massive pl/sql package where some of the processing is taking too long so they want to try multithreading it.
    The data in this package is stored in an array of records which contains nested tables, which themselves contain nested tables.
    So, we want to split this table into 10, and submit them to 10 dbms_jobs to run concurrently, write the modified arrays to the database so they can be picked up again by the original process.
    I'm stuck on converting the associative array of data (containing tables of records) into objects which can be stored in the DB.
    My database objects:
    CREATE OR REPLACE
    TYPE ktest_claims_rt IS OBJECT
         col1 varchar2(10)
        ,col2 varchar2(10));
    CREATE OR REPLACE
      TYPE ktest_claims_tt IS TABLE OF ktest_claims_rt;
    CREATE OR REPLACE
    TYPE ktest_driver_rt IS OBJECT
         col1      varchar2(10)
        ,col2      varchar2(10)
        ,claims_nt ktest_claims_tt);
    CREATE OR REPLACE
      TYPE ktest_driver_tt IS TABLE OF ktest_driver_rt;
    CREATE OR REPLACE
    TYPE ktest_policy_rt IS OBJECT
         col1       varchar2(10)
        ,col2       varchar2(10)
        ,driver_nt  ktest_driver_tt);
    CREATE OR REPLACE
      TYPE ktest_policy_tt IS TABLE OF ktest_policy_rt;
    CREATE TABLE ktest_job_table
      (job_no        NUMBER
      ,tab_type      VARCHAR2(3)
      ,policy_nt     ktest_policy_tt
      NESTED TABLE policy_nt STORE AS policy_nested_tab
        (NESTED TABLE driver_nt STORE AS driver_nested_tab
           (NESTED TABLE claims_nt STORE AS claims_nested_tab))
    / And my local package versions:
       TYPE claims_rt IS RECORD
         col1 varchar2(10)
        ,col2 varchar2(10));
       TYPE claims_tt IS TABLE OF claims_rt INDEX BY PLS_INTEGER;
       TYPE driver_rt IS RECORD
         col1       varchar2(10)
        ,col2       varchar2(10)
        ,claims_nt  claims_tt);
       TYPE driver_tt IS TABLE OF driver_rt INDEX BY VARCHAR2(20);
       TYPE policy_rt IS RECORD
            policy_no   policy.policy_no%TYPE
           ,driver_tab  driver_tt
           ,other_col   VARCHAR2(20));
       TYPE policy_tt IS TABLE OF policy_rt
            INDEX BY pls_integer;
       main_table  policy_tt;What I can't get through my pea sized brain is how to turn "main_table" into an array based on ktest_policy_tt.
    I got as far as:
       FUNCTION convert (p_table IN policy_tt) RETURN ktest_policy_tt
       IS
          db_vers  ktest_policy_tt := ktest_policy_tt();
          db_rec   ktest_policy_rt;
       BEGIN
          FOR i IN p_table.FIRST..p_table.LAST
          LOOP
             db_rec := ktest_policy_rt(p_table(i).policy_no
                                      ,p_table(i).other_col
                                      ,ktest_driver_tt(p_table(i).driver_tab(i).col1
                                                      ,p_table(i).driver_tab(i).col2
                                                      ,ktest_claims_tt(p_table(i).driver_tab(i).claims_nt(i).col1
                                                                      ,p_table(i).driver_tab(i).claims_nt(i).col1
             db_vers(i) := db_rec;
          END LOOP;
       END;but, apart from the fact that it only coverts the first row of each table, it doesn't compile:
    LINE/COL ERROR
    139/10   PL/SQL: Statement ignored
    143/52   PLS-00306: wrong number or types of arguments in call to
             'KTEST_CLAIMS_TT'
    143/52   PLS-00306: wrong number or types of arguments in call to
             'KTEST_CLAIMS_TT'I'd appreciate any help as this is getting urgent.
    Thanks!

    I would recommend writing your function in a more stepwise, explicit fashion rather than trying to write the conversion as basically one big constructor.
    Firstly, you will require nested loops in your pl/sql code for the different levels of nested tables. This is not a choice, you need to do this.
    Within each level of looping, explicitly create the object of the desired type before adding it to the table / record as need be.
    cheers,
    Anthony

  • CAST and MULTISET with nested table

    I am trying to figure out the syntax of using
    MULTISET. I have two queries.
    One very basic where I want to cast the station names
    and ids, retrieved from a regular table into a nested
    table.
    e.g.
    SELECT cast(multiset(stn_id, stn_name) as castTab) FROM station_tab WHERE stn_name like '%xyz%';
    The other retrieve sections of a nested table and cast back as
    nested table type.
    SELECT * FROM CAST(MULTISET(SELECT * FROM
    THE (SELECT tmn_history FROM tmin WHERE tmn_stn_ncdcid = 01063456) NT
    WHERE (EXTRACT(YEAR FROM NT.dta_date) = 1915) AS data_tab ;
    The schema/tables are as follows
    =========================================================================
    CREATE TABLE station_tab
         stn_id     INTEGER PRIMARY KEY,
         stn_name VARCHAR(50)
    CREATE OR REPLACE TYPE data_point AS OBJECT
         dta_date      DATE,
         dta_val NUMBER,
         dta_dtobtnd DATE
    CREATE OR REPLACE TYPE data_tab AS TABLE OF data_point;
    CREATE TABLE tmin
    tmn_stn_id     INTEGER ,
    tmn_history data_tab
    ) NESTED TABLE tmn_history STORE AS tmn_history_tab;
    CREATE OR REPLACE TYPE castObj AS OBJECT
         dta_val NUMBER,
         stn_name VARCHAR(50)
    CREATE OR REPLACE TYPE castTab AS TABLE OF castObj;
    =====================================================================
    Thank you.
    barr

    With trial and error and going thru the examples
    in AskTom and documentation found that the follwing syntax works.
    (Also realized this is the wrong forum);
    SELECT * FROM TABLE (cast(multiset
    (SELECT stn_ncdcid,stn_name FROM station_tab WHERE stn_name LIKE '%WSFO%')
    AS castTab));
    select * FROM TABLE (CAST(MULTISET (SELECT * FROM
    THE (SELECT tmn_history FROM tmin WHERE tmn_stn_ncdcid = 01063456) NT
    WHERE (EXTRACT(YEAR FROM NT.dta_date) = 1915)
    ORDER BY NT.dta_date) as data_tab)) ;

  • Help with Nested Table

    Hello All
    I have a task about insert data into a nested table. First I will explain the scenario.
    I have 2 table (patients) and (tumors) that contain medical data about cancer patients.
    CREATE TABLE "DSS2_MINING"."PATIENTS"
       (     "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE,
         "REGISTRY_ID" NUMBER(10,0),
         "RACE" VARCHAR2(2 BYTE),
         "SEX" VARCHAR2(1 BYTE),
         "BIRTHDATE_YEAR" NUMBER(4,0),
         "NUMBER_OF_PRIMARIES" NUMBER(1,0),
         "VITAL_STATUS_RECORD" VARCHAR2(1 BYTE),
         "CAUSE_OF_DEATH" VARCHAR2(5 BYTE),
         "SURVIVAL_TIME" VARCHAR2(4 BYTE),
         "SURVIVAL_TIME_FINAL" NUMBER,
         "SURVIVAL_VARIABLE" VARCHAR2(1 BYTE),
          CONSTRAINT "PATIENTS_PK" PRIMARY KEY ("PATIENT_ID");
    CREATE TABLE "DSS2_MINING"."TUMORS"
       (     "TUMOR_ID" NUMBER NOT NULL ENABLE,
         "PATIENT_ID" VARCHAR2(10 BYTE),   -- FK
         "SEER_RECORD_NUMBER" NUMBER,       -- This column contain a sequance number of the records for each patients
         "MARITAL_STATUS" VARCHAR2(1 BYTE),
         "AGE" NUMBER,
         "DATE_OF_DIAGNOSIS" DATE,
         "HISTOLOGY_GROUP" VARCHAR2(2 BYTE),
         "BEHAVIOR" VARCHAR2(1 BYTE),
         "GRADE" VARCHAR2(1 BYTE),
         "DERIVED_AJCC_STAGE_GROUP" VARCHAR2(2 BYTE),
         "STAGE_OF_CANCER" VARCHAR2(2 BYTE),
         "RADIATION" VARCHAR2(1 BYTE),
         "CS_SCHEMA" VARCHAR2(2 BYTE),
         "FIRST_PRIMARY_IND" VARCHAR2(1 BYTE),
         "TUMOR_SIZE" NUMBER(4,1),
         "TUMOR_EXTENSION" VARCHAR2(2 BYTE),
         "LYMPH_NODES" VARCHAR2(1 BYTE),
         "NODES_POSITIVE" NUMBER,
         "ESTROGEN" VARCHAR2(3 BYTE),
         "PROGESTERONE" VARCHAR2(3 BYTE),
         "SURGERY" VARCHAR2(2 BYTE),
          CONSTRAINT "TUMORS_PK" PRIMARY KEY ("TUMOR_ID");The table (patients) contain the basic information about the patients. The table (tumors) contain information about the tumors. each record in the (patients) table can have one or more records in the (tumors) table using the (patient_id) column. I wanna move the data from the (patients) and (tumors) tables to a new table (cancer_patients) that contain a nested table column. so I did the following code
    create or replace type tumor_object AS
    object(
    tumor_id VARCHAR2(1),  
    marital_status VARCHAR2(1),  
    age NUMBER(3),  
    date_of_diagnosis DATE, 
    cs_schema VARCHAR2(2),  
    histology_group VARCHAR2(2),  
    behavior VARCHAR2(1),  
    grade VARCHAR2(1),  
    first_primary_ind VARCHAR2(1),  
    tumor_size NUMBER(4,   1),  
    tumor_extension VARCHAR2(2),  
    lymph_nodes VARCHAR2(1),  
    nodes_positive NUMBER(4),  
    surgery VARCHAR2(2),
    radiation VARCHAR2(1)
    create or replace type tumor_table as table of tumor_object;
      CREATE TABLE "DSS2_MINING"."CANCER_PATIENTS"
       (     "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE,
         "RACE" VARCHAR2(2 BYTE),
         "SEX" VARCHAR2(1 BYTE),
         "NUMBER_OF_PRIMARIES" NUMBER(1,0),
         "TUMORS" "DSS2_MINING"."TUMOR_TABLE" ,
         "VITAL_STATUS_RECORD" VARCHAR2(1 BYTE),
         "CAUSE_OF_DEATH" VARCHAR2(5 BYTE),
         "SURVIVAL_TIME_FINAL" NUMBER,
         "SURVIVAL_VARIABLE" VARCHAR2(1 BYTE),
          CONSTRAINT "CANCER_PATIENTS_PK" PRIMARY KEY ("PATIENT_ID")
       NESTED TABLE "TUMORS" STORE AS "TUMORS_STOR_TABLE"
    So my problem about how to transfer and insert the data, I tried to use the associative array to hold the rows of the tumors table but it didn't work out. I think the main issue is that each record in the patients table have multiple records in the tumors table.
    I hope if anybody can help in this case or I you know any reference about similar cases
    Thanks
    A.L
    Edited by: user9003901 on Nov 26, 2010 2:48 AM

    Something like:
    INSERT
      INTO CANCER_PATIENTS
      SELECT  PATIENT_ID,
              RACE,
              SEX,
              NUMBER_OF_PRIMARIES,
               SELECT  CAST(
                            COLLECT(
                                    TUMOR_OBJECT(
                                                 TUMOR_ID,
                                                 MARITAL_STATUS,
                                                 AGE,
                                                 DATE_OF_DIAGNOSIS,
                                                 CS_SCHEMA,
                                                 HISTOLOGY_GROUP,
                                                 BEHAVIOR,
                                                 GRADE,
                                                 FIRST_PRIMARY_IND,
                                                 TUMOR_SIZE,
                                                 TUMOR_EXTENSION,
                                                 LYMPH_NODES,
                                                 NODES_POSITIVE,
                                                 SURGERY ,
                                                 RADIATION
                            AS TUMOR_TABLE
                 FROM  "TUMORS" T
                 WHERE T.PATIENT_ID = P.PATIENT_ID
              VITAL_STATUS_RECORD,
              CAUSE_OF_DEATH,
              SURVIVAL_TIME_FINAL,
              SURVIVAL_VARIABLE
        FROM  PATIENTS P
    /SY.
    P.S. This site has censorship. It replaces word S E X with ***, so change it back when testing.

  • Nested tables as separate lines in output

    I'm working with Adobe forms using transaction SFP from the ABAP Workbench. I'm trying to construct a prototype of an SD invoice, with one internal table having the basic item data, and then a secondary table with further information, such as discounts, taxes, etc. The item number is part of both tables so that they can be related to each other. Using right-click and Create in the context I constructed a loop on the main table, and then under that a loop on the secondary table, with the equal item number as a condition. It all works, but in the output the secondary data comes out on the same line as the main item data, and when I try to drag it down to the next line in the layout, it changes its position in the data view also, so that it's outside the loop and prints only once, over the second main item line. Surely for an invoice or a purchase order it's normal to have one basic item line, and then one or more other lines with various other information for each item. It's very easy in both SAPscript and Smart Forms to have a loop within a loop displaying separate lines, but so far I haven't been able to get it to work with Adobe.

    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
      2  /
    Type created.
    SQL> CREATE TABLE r(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_1;
    Table created.
    SQL> CREATE TABLE s(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_2;
    Table created.
    SQL> INSERT INTO r VALUES (1, table_type ('a', 'b'));
    1 row created.
    SQL> INSERT INTO s VALUES (1, table_type ('b', 'c'));
    1 row created.
    SQL> COLUMN c FORMAT A10;
    SQL> SELECT r.a, r.b MULTISET UNION DISTINCT s.b c
      2  FROM   r, s
      3  WHERE  r.a = s.a;
             A C
             1 TABLE_TYPE('a', 'b', 'c')
    SQL>

  • 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

Maybe you are looking for