Can't insert into nested table

I can't inserted into a nested table and my SQL is listed below.
SQL> CREATE TYPE naming_t AS OBJECT (name VARCHAR2(30), alias VARCHAR2(30)) NOT FINAL;
2 /
Type created.
SQL> CREATE TYPE terminal_t;
2 /
Type created.
SQL> CREATE TYPE terminal_t_nt AS TABLE OF REF terminal_t;
2 /
Type created.
SQL> CREATE TYPE connectivitynode_t UNDER naming_t (terminals terminal_t_nt) NOT FINAL;
2 /
Type created.
SQL> CREATE TYPE connectivitynode_t_nt AS TABLE OF REF connectivitynode_t;
2 /
Type created.
SQL> CREATE TYPE terminal_t UNDER naming_t (connectivitynodes connectivitynode_t_nt) NOT FINAL;
2 /
Type created.
SQL>
SQL> CREATE TABLE naming_tb     (name VARCHAR2(30), alias VARCHAR2(30));
Table created.
SQL> CREATE TABLE connectivitynode_tb (name VARCHAR2(30), terminals terminal_t_nt) NESTED TABLE terminals STORE AS terminals_tb;
Table created.
SQL> CREATE TABLE terminal_tb     (name VARCHAR2(30), connectivitynodes connectivitynode_t_nt) NESTED TABLE connectivitynodes STORE AS connectivitynodes_tb;
Table created.
SQL>
SQL> INSERT INTO naming_tb (name) VALUES ('AP1.132.B/C.T1');
1 row created.
SQL> INSERT INTO terminal_tb (name) VALUES ('AP1.132.B/C.T1');
1 row created.
SQL> INSERT INTO naming_tb (name) VALUES ('AP1.132.B/C.T2');
1 row created.
SQL> INSERT INTO terminal_tb (name) VALUES ('AP1.132.B/C.T2');
1 row created.
SQL>
SQL> INSERT INTO naming_tb (name) VALUES ('AP1.132.B/C.N1');
1 row created.
SQL> INSERT INTO connectivitynode_tb (name) VALUES ('AP1.132.B/C.N1');
1 row created.
SQL> INSERT INTO TABLE (SELECT terminals FROM connectivitynode_tb WHERE name='AP1.132.B/C.N1') SELECT REF(p) FROM terminal WHERE p.name='AP1.132.B/C.T1' OR p.name='AP1.132.B/C.T2';
INSERT INTO TABLE (SELECT terminals FROM connectivitynode_tb WHERE name='AP1.132.B/C.N1') SELECT REF(p) FROM terminal WHERE p.name='AP1.132.B/C.T1' OR p.name='AP1.132.B/C.T2'
ERROR at line 1:
ORA-00942: table or view does not exist

I think you dont have the table terminal referred in following select statement
SELECT REF(p) FROM terminal WHERE p.name='AP1.132.B/C.T1' OR p.name='AP1.132.B/C.T2';
Chandar

Similar Messages

  • How can I insert into a table other than the default table in a form

    Hi,
    I want to insert into a table with some fields value of a form of another table. I have written insert code On successful submission of that form, but after submit it gives the following error
    An unexpected error occurred: ORA-06502: PL/SQL: numeric or value error (WWV-16016)
    My code is like this
    declare
    l_trn_id number;
    l_provider_role varchar2(3);
    l_provider_id varchar2(10);
    begin
    l_trn_id := p_session.get_value_as_number(p_block_name=>'DEFAULT',p_attribute_name=>'A_TRANSACTION_ID');
    l_provider_id := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT',p_attribute_name=>'A_PROVIDER1');
    l_PROVIDER_ROLE := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT',p_attribute_name=>'A_PROVIDER_ROLE1');
    if (l_provider_role is not null) and (l_provider_id is not null) then
    insert into service_provider_trans_records(service_provider_id,transaction_id,role_type_id)
    values(l_provider_id, l_trn_id, l_provider_role);
    commit;
    end if;
    end;
    Where 'PROVIDER1' and 'PROVIDER_ROLE1' are not table fields.
    How can do that or why this error comes ? Any idea?
    Thanks
    Sumita

    Hi,
    When do you get this error? Is it while running or while creating the form.
    Here is a sample code which inserts a non-database column dummy into a table called dummy. This is done in successful procedure.
    declare
    l_dummy varchar2(1000);
    begin
    l_dummy := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT',
    p_attribute_name=>'A_DUMMY');
    insert into sjayaram903_1g.dummy values(l_dummy);commit;
    end;
    Please check in your case if the size of the local variable is enough to hold the values being returned.
    Thanks,
    Sharmila

  • Insert into Nested Tables

    Good day All,
    I am working on my first nested table and having difficulty with INSERTS. Can someone explain what I am doing wrong?
    Many Thanks,
    Danny
    describe PAT_HOST_SYSTEM
    Name Null Type
    HOST_ID NOT NULL NUMBER
    IPADDR NOT NULL VARCHAR2(16 CHAR)
    OS VARCHAR2(50 CHAR)
    OS_VERSION VARCHAR2(254 CHAR)
    KERNEL VARCHAR2(75 CHAR)
    KERNEL_BUILD VARCHAR2(75 CHAR)
    LAST_REBOOT VARCHAR2(50 CHAR)
    OS_PATCH VARCHAR2(50 CHAR)
    NUM_OF_CPU VARCHAR2(20 CHAR)
    GLOBAL_ZONE VARCHAR2(3)
    LOCAL_ZONE VARCHAR2(3)
    MACHINE VARCHAR2(255)
    UPTIME VARCHAR2(50)
    LAST_UPDATE DATE
    ZONE_CHILDREN LOCAL_ZONE()
    15 rows selected
    describe LOCAL_ZONE
    user type definition
    TYPE local_zone AS OBJECT
    (ID VARCHAR2(50),
    ZONE_NAME VARCHAR2(50));
    3 rows selected
    INSERT INTO TABLE (SELECT ZONE_CHILDREN FROM PAT_HOST_SYSTEM WHERE HOST_ID='561') VALUES ('a808d6ceee', 'tspxxx01');
    Error starting at line 1 in command:
    INSERT INTO TABLE (SELECT ZONE_CHILDREN FROM PAT_HOST_SYSTEM WHERE HOST_ID='561') VALUES ('a808d6ceee', 'tspxxx01')
    Error at Command Line:1 Column:12
    Error report:
    SQL Error: ORA-22905: cannot access rows from a non-nested table item
    22905. 00000 - "cannot access rows from a non-nested table item"
    *Cause:    attempt to access rows of an item whose type is not known at
    parse time or that is not of a nested table type
    *Action:   use CAST to cast the item to a nested table type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

    Hello Danny and welcome to the forum,
    are you trying to insert data into a table which has a collection as a column ?
    The phrase nested table was very misleading (at least for me), also the code you posted was kinda incomplete.
    I could not follow the code you posted, alternately I am posting some sample code with the DDL and insert statements for your understanding.
    create or replace type emp_obj as object
      ejob varchar2(100),
      comm number,
      edeptno number
    create table employee
    (ename varchar2(50),
    empno number,
    esal  number,
    edetails emp_obj
    /Populating the employee table with INSERT :
    insert into employee values ('KING',7839,5000,emp_obj('PRESIDENT',0,10));
    insert into employee values ('BLAKE',7698,2850,emp_obj('MANAGER',0,30));Now, querying the table for all columns with SELECT :
    ENAME     EMPNO     ESAL     EDETAILS.EJOB     EDETAILS.COMM     EDETAILS.EDEPTNO
    KING     7839     5000     PRESIDENT         0                 10
    BLAKE     7698     2850     MANAGER       0                 30Hope it is now clear.

  • Why I can not insert into a table?

    Hi, all,
    I have a table "personstudy" with records already. Its primary key is "subjectid". and I have added a new column named "personstatus" varchar2(20) to it. After that, I want to insert into the field with "enrolled" for all records there. My script is like this:
    insert into personstudy (personstatus) values ('enrolled');
    the system reports:
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("FLOWLIMS"."PERSONSTUDY"."SUBJECTID")
    I just can not understand it. Is there any wrong with my script?
    Thank you!
    Qian

    maybe want you need is not insert a new rows but to update the existing records to have the 'enrolled' value put into the column personstatus.
      update personstudy
         set personstatus = 'enrolled';

  • Can you insert into a table without having the table structure in place

    I have tried to use the import wizard insert data in a CSV file into a table;
    I have 7 column headers, however, where there are extra commas in a field the wizard just combines the 2 fields so that i get a total of 7 columns even though there should be more.
    any ideas how i can round this problem?
    should i use bulk copy?
    sukai

    Are you using correct text qualifiers in the CSV?
    Satheesh
    My Blog |
    How to ask questions in technical forum

  • How can i insert into dynamic table  ?

    i have regular internal table with data  .
    i have dynamic table <dyn_tab>
    i insert the data from itab
    MOVE-CORRESPONDING ITAB TO <LS_LINE>.
        INSERT <LS_LINE> INTO TABLE <DYN_TABLE>.
    OK  , NOW I WANT TO ADD THE DATA FROM OTHER TABLE
    THAT HOLD THE DATA THAT ALL THE DYNAMIC TAB BUILD FOR
    HOW CAN I DO THIS INSERT  ?
    I NEED TO INSERT "KOSTL" TO MATCH LINE in <DYN_TABLE>
    THIS WHAT I TRIED TO DO :
          SHIFT INDX1 LEFT DELETING LEADING SPACE.
          CONCATENATE 'KOSTL' INDX1 INTO FIELD .
    ASSIGN COMPONENT FIELD  OF STRUCTURE <DYN_TABLE> TO <FS>.
    <FS> = IT_EKKN-KOSTL.
      but i get dump that <FS> not been assign .

    hi, 
    pls chk the sample code below.
    REPORT zmaschl_create_data_dynamic .
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
    is_fcat LIKE LINE OF it_fcat.
    DATA: it_fieldcat TYPE lvc_t_fcat,
    is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data.
    DATA: new_line TYPE REF TO data.
    FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
    <l_line> TYPE ANY,
    <l_field> TYPE ANY.
    * Build fieldcat
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = 'SYST'
    CHANGING
    ct_fieldcat = it_fcat[].
    LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
    MOVE-CORRESPONDING is_fcat TO is_fieldcat.
    is_fieldcat-fieldname = is_fcat-fieldname.
    is_fieldcat-ref_field = is_fcat-fieldname.
    is_fieldcat-ref_table = is_fcat-ref_tabname.
    APPEND is_fieldcat TO it_fieldcat.
    ENDLOOP.
    * Create a new Table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = it_fieldcat
    IMPORTING
    ep_table = new_table.
    * Create a new Line with the same structure of the table.
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    * Test it...
    DO 30 TIMES.
    ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
    <l_field> = sy-index.
    INSERT <l_line> INTO TABLE <l_table>.
    ENDDO.
    LOOP AT <l_table> ASSIGNING <l_line>.
    ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
    WRITE <l_field>.
    ENDLOOP.
    Regards
    Anver
    <i>if hlped pls mark points</i>

  • BizTalk 2013 R2 - Oracle client (Insert into Multiple tables) CompositE Transaction

    I know there is Composite Transaction of  inserting into multiple tables in SQL.
    Is there a way where we can have inserts into multiple table at once ? If yes, can anyone please provide step by step procedure to achieve this  
    MBH

    Here is a link on using Oracle DB w/ composite operations: 
    Performing Composite Operations on Oracle Database by Using BizTalk Server
    Rachit
    Please mark as answer or vote as helpful if my reply does

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

  • Insert data into nested tables

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

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

  • How can I get a count at the same time I am inserting into another table

    I have a requirement where I have to find out the count(number of records inserted into another table) at the same time I insert into the table:
    Like
    I am copying records from table B to A, while doing this I have to find out how many records I've inserted since I need this count in subsequent steps
    INSERT INTO A
    SELECT * FROM B
    how can I store the count into any variable while doing above statement
    Please advice

    No, Warren that doesn't work!
    SQL> set serveroutput on
    SQL> declare
      2     vCtr  number := 0;
      3  begin
      4     insert into emp2
      5     select * from emp;
      6
      7     select count(*)
      8       into vCtr
      9       from emp2;
    10
    11     dbms_output.put_line('rows created '||to_char(vCtr));
    12  end;
    13  /
    rows created 15
    PL/SQL procedure successfully completed.
    SQL> declare
      2     vCtr  number := 0;
      3  begin
      4     insert into emp2
      5     select * from emp;
      6
      7     select count(*)
      8       into vCtr
      9       from emp2;
    10
    11     dbms_output.put_line('rows created '||to_char(vCtr));
    12  end;
    13  /
    rows created 30
    PL/SQL procedure successfully completed.
    SQL>

  • Can select, but cannot insert into oracle tables using php.

    I am having trouble inserting data into a tables in oracle using PHP. I can insert into the tables using baninst1, but nothing else. I can't even insert using the tables' owner. Every time I try I get the ORA-00492 error of table or view does not exist. However, I can run a select statement just fine. So far, baninst1 is the only user that can actually do inserts. I've triple checked all the table grants and everything is fine. Also, I can copy/paste the exact insert statement into SQL*Plus and it works with the correct user. It doesn't have to be baninst1. I've tried everything I can think of. I've tried putting the table name in quotes, adding the schema name to the table, checking public synonyms, but everything appears to be ok. I would greatly appreciate any suggestions others may have.
    I'm using PHP 5.2.3 with an oracle 9i DB.

    Here is the code that doesn't work. It works only with baninst1, no other username will work and all I do is change the my_username/my_password to something different. This is one example function where I try to do an insert, but it doesn't work on any of the tables I try.
    Thanks for looking.
    class Oracle {
         private $oracleUser = "my_username";
         private $oraclePassword = "my_password";
         private $oracleDB = "MY_DB";
         private $c = null;
         function Connect() {
              if ( !($this->c = ocilogon( $this->oracleUser, $this->oraclePassword, $this->oracleDB ) ) )
                   return false;
              return true;
         function AddNewTest($testName, $course, $section, $term, $maxAttempts, $length, $startDate, $startTime, $endDate, $endTime)
              $result = "";
              if( $this->c == null )
                   $this->Connect();     
              $splitIndex = strpos($course, " ");
              $subjectCode = substr($course, 0, $splitIndex);
              $courseNumber = substr($course, $splitIndex + 1);
              $insertStatment = "insert into szbtestinfo(szbtestinfo_test_name,
                                                                szbtestinfo_course_numb,
                                                           szbtestinfo_section,
                                                                szbtestinfo_max_attempts,
                                                                szbtestinfo_length_minutes,
                                                                szbtestinfo_start,
                                                                szbtestinfo_end,
                                                                szbtestinfo_id,
                                                                szbtestinfo_subj_code,
                                                                szbtestinfo_eff_term)
                                                                values( '" . $testName .
                   "', '" . $courseNumber .
                   "', '" . $section .
                   "', " . $maxAttempts .
                   ", " . $length .
                   ", to_date('" . $startDate . " " . $startTime . "', 'MM/DD/YYYY HH24:MI')" .
                   ", to_date('" . $endDate . " " . $endTime . "', 'MM/DD/YYYY HH24:MI')" .
                   ", szsnexttest.nextval" .
                   ", '" . $subjectCode .
                   "', '" . $term . "')";
              //return $insertStatment;
              $s = OCIParse($this->c, $insertStatment);
              try
                   $result = OCIExecute($s);
              catch(exception $e)
              return $result;
         }

  • How can i use the nested table in form 6i

    how can i use the nested table in the form 6i
    ( i.e i want to insert record into the nestred table field ).
    bye siddharth singh

    Nested tables are not supported in Forms 6i, only simple object tables.

  • Inserting into a table which is created "on the fly" from a trigger

    Hello all,
    I am trying to insert into a table from a trigger in Oracle form. The table name however, is inputted by the user in am item form.
    here is what the insert looks like:
    insert into :table_name
    values (:value1, :value2);
    the problem is that forms does not recognize ::table_name. If I replace :table_name with an actual database table, it works fine. However, I need to insert to a table_name based from oracle form item.
    By the way, the table|_name is built on the fly using a procedure before I try to insert into it.
    Any suggestion on how can I do that? My code in the trigger is:
    declare
    dm_drop_tbl(:table_name,'table) // a call to an external procedure to drop the table
    dm_create_tbl(:table_name,'att1','att2');
    insert into :table_name
    values (:value1, :value2);
    this give me an error:
    encounter "" when the symbol expecting one.....

    Hi ,
    You should use the FORMS_DDL built_in procedure. Read the on-line documentation of forms ...
    Simon

  • Problem while inserting into a table which has ManyToOne relation

    Problem while inserting into a table *(Files)* which has ManyToOne relation with another table *(Folder)* involving a attribute both in primary key as well as in foreign key in JPA 1.0.
    Relevent Code
    Entities:
    public class Files implements Serializable {
    @EmbeddedId
    protected FilesPK filesPK;
    private String filename;
    @JoinColumns({
    @JoinColumn(name = "folder_id", referencedColumnName = "folder_id"),
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Folders folders;
    public class FilesPK implements Serializable {
    private int fileId;
    private int uid;
    public class Folders implements Serializable {
    @EmbeddedId
    protected FoldersPK foldersPK;
    private String folderName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "folders")
    private Collection<Files> filesCollection;
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Users users;
    public class FoldersPK implements Serializable {
    private int folderId;
    private int uid;
    public class Users implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer uid;
    private String username;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
    private Collection<Folders> foldersCollection;
    I left out @Basic & @Column annotations for sake of less code.
    EJB method
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    FoldersPK folderPk = new FoldersPK(folderID, uid);
         // My understanding that it should automatically handle folderId in files table,
    // but it is not…
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    It is giving error:
    Internal Exception: java.sql.SQLException: Field 'folderid' doesn't have a default value_
    Error Code: 1364
    Call: INSERT INTO files (filename, uid, fileid) VALUES (?, ?, ?)_
    _       bind => [hello.txt, 1, 0]_
    It is not even considering folderId while inserting into db.
    However it works fine when I add folderId variable in Files entity and changed insertFile like this:
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    file.setFolderId(folderId) // added line
    FoldersPK folderPk = new FoldersPK(folderID, uid);
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    My question is that is this behavior expected or it is a bug.
    Is it required to add "column_name" variable separately even when an entity has reference to ManyToOne mapping foreign Entity ?
    I used Mysql 5.1 for database, then generate entities using toplink, JPA 1.0, glassfish v2.1.
    I've also tested this using eclipselink and got same error.
    Please provide some pointers.
    Thanks

    Hello,
    What version of EclipseLink did you try? This looks like bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280436 that was fixed in EclipseLink 2.0, so please try a later version.
    You can also try working around the problem by making both fields writable through the reference mapping.
    Best Regards,
    Chris

  • How to insert into 2 tables from the same page (with one button  link)

    Hi,
    I have the following 2 tables....
    Employees
    emp_id number not null
    name varchar2(30) not null
    email varchar2(50)
    hire_date date
    dept_id number
    PK = emp_id
    FK = dept_id
    Notes
    note_id number not null
    added_on date not null
    added_by varchar2(30) not null
    note varchar2(4000)
    emp_id number not null
    PK = note_id
    FK = emp_id
    I want to do an insert into both tables via the application and also via the same page (with one button link). I have made a form to add an employee with an add button - adding an employee is no problem.
    Now, on the same page, I have added a html text area in another region, where the user can write a note. But how do I get the note to insert into the Notes table when the user clicks the add button?
    In other words, when the user clicks 'add', the employee information should be inserted into the Employees table and the note should be inserted into the Notes table.
    How do I go about doing this?
    Thanks.

    Hi,
    These are my After Submit Processes...
    After Submit
    30     Process Row of NOTES     Automatic Row Processing (DML)     Unconditional
    30     Process Row of EMPLOYEES     Automatic Row Processing (DML)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    50     Insert into Tables     PL/SQL anonymous block     Conditional
    My pl/sql code is the same as posted earlier.
    Upon inserting data into the forms and clicking the add button, I get this error...
    ORA-06550: line 1, column 102: PL/SQL: ORA-00904: "NOTES": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
         Error      Unable to process row of table EMPLOYEES.
    Is there something wrong with the pl/sql code or is it something else?

Maybe you are looking for

  • Enter a name and city for one-time account posting is the message i get

    Enter a name and city for one-time account posting is the message i get ,when i am trying to post a onetime vendor .I have entered name ,country and language when the pop comes.But still throws me this message ,pls help.

  • ICloud password doesn't work

    Ever since updating to Mavericks, every time I turn on or restart my laptop, I am prompted to enter my iCloud password. This is annoying enough, but to make matters worse, it keeps telling me I am entering the wrong password. I AM NOT!  Help?

  • ITunes U downloads Numbers as a .zip file to iOS

    I have uploaded six Numbers [v 3.2 (1861)] spreadsheets to an iTunes U course. Five of them download to my iPad [iOS 7.2] and open in Numbers, but one downloads as a .zip file and cannot be opened. This problem was identified by a student, so the sam

  • Plugging in ipod

    Is it true that the first time you open up itunes you have to plug in your ipod nano? Do i need a 2.0 usb?

  • Question about java thread implementation

    Hi All, I am comparing the performance of the Dining philosopher's problem implemented in Java, Ada, C/Pthread, and the experimental language I have been working on. The algorithm is very simple: let a butler to restrict entry to the eating table, so