Inserting into a doubly nested table through an object view

Can anyone give me an example of an INSTEAD OF trigger that will mediate an INSERT into a doubly nested table of an Object View? Is there syntax that will allow it?

Here's some code to demonstrate. Note that relational tables, not an object table, are used to store object instances:
create or replace type TInnerNestedTable
is table of varchar2(20)
create or replace type TOuterNestedTable
is table of TInnerNestedTable
create or replace type TMyObject
is object
     id     varchar2(20)
,     tab     TOuterNestedTable
create
table     T_MY_OBJECT
     id          varchar2(20)     not null
,     primary key (id)
create
table     T_MY_OBJECT_TAB_OUTER
     id          varchar2(20)     not null
,     outerIndex     integer          not null
,     primary key (id, outerIndex)
,     foreign key (id) references T_MY_OBJECT on delete cascade
create
table     T_MY_OBJECT_TAB_INNER
     id          varchar2(20)     not null
,     outerIndex     integer          not null
,     innerIndex     integer          not null
,     innerValue     varchar2(20)
,     primary key (id, outerIndex, innerIndex)
,     foreign key (id, outerIndex) references T_MY_OBJECT_TAB_OUTER on delete cascade
create or replace view V_MY_OBJECT
of TMyObject
with object identifier (id)
as
select     t.id
,     cast(multiset(
          select     cast(multiset(
                    select     i.innerValue
                    from     T_MY_OBJECT_TAB_INNER i
                    where     i.id = o.id
                    and     i.outerIndex = o.outerIndex
               ) as TInnerNestedTable)
          from     T_MY_OBJECT_TAB_OUTER o
          where     o.id = t.id
     ) as TOuterNestedTable)
from     T_MY_OBJECT t
create or replace trigger TR_II_V_MY_OBJECT
instead of insert on V_MY_OBJECT
for each row
begin
     insert
     into     T_MY_OBJECT
          id
     values     (
          :new.id
     insert
     into     T_MY_OBJECT_TAB_OUTER
          id
     ,     outerIndex
     select     :new.id
     ,     rownum
     from     table(:new.tab) o;
     insert
     into     T_MY_OBJECT_TAB_INNER
          id
     ,     outerIndex
     ,     innerIndex
     ,     innerValue
     select     :new.id
     ,     o.outerIndex
     ,     rownum
     ,     value(i)
     from     (
          select     :new.id
          ,     rownum outerIndex
          ,     value(o) innerTab
          from     table(:new.tab) o
          ) o
     ,     table(o.innerTab) i;
end;
insert
into     V_MY_OBJECT
values     (
     new TMyObject(
          'A'
     ,     TOuterNestedTable(
               TInnerNestedTable('A','B','C')
          ,     TInnerNestedTable('AA')
          ,     TInnerNestedTable('AB')
insert
into     V_MY_OBJECT
values     (
     new TMyObject(
          'B'
     ,     TOuterNestedTable(
               TInnerNestedTable('X','Y','Z')
          ,     TInnerNestedTable('Hello', 'World!')
/Selecting from the view shows the results:
select     value(o)
from     V_MY_OBJECT o
VALUE(O)(ID, TAB)
TMYOBJECT('A', TOUTERNESTEDTABLE(TINNERNESTEDTABLE('A', 'B', 'C'), TINNERNESTEDTABLE('AA'), TINNERNESTEDTABLE('AB')))
TMYOBJECT('B', TOUTERNESTEDTABLE(TINNERNESTEDTABLE('X', 'Y', 'Z'), TINNERNESTEDTABLE('Hello', 'World!')))
2 rows selected.Hope that helps...
Gerard

Similar Messages

  • Nested table type in object view on 8.1.7

    Object views seem to be the ideal way to deliver XML datagrams from database queries with nested data.
    I need to create a datagram that contains nested data within another nested set of data eg. a family has many people, each person may have many hobbies.
    The following code taken from Oracle documentation would create the Types I need, but this does not work on 8.1.7 (gets PLS-00534 error). Can someone advise if nested tables within a table type is a new Oracle 9 feature?
    CREATE TYPE project_t AS OBJECT
    ( projname VARHCAR2(20)
    , mgr VARHCAR2(20));
    CREATE TYPE nt_project_t AS TABLE OF project_t;
    CREATE TYPE emp_t AS OBJECT
    ( ename VARCHAR2(20)
    , salary NUMBER
    , deptname VARHCAR2(20)
    , projects nt_project_t);
    CREATE TYPE nt_emp_t AS TABLE OF emp_t;
    CREATE TYPE dept_t AS OBJECT
    ( deptno NUMBER
    , deptname VARHCAR2(20)
    , emps nt_emp_t);
    Thks, Matt. (asked same question in XML forum but maybe more appropriate here).
    null

    Matthew,
    Value-based multi-level collections, such as the one you have here, were not supported in 8.1.7. You have two choices:
    1. Upgrade to 9i to take advantage of value-based multi-level collections (see http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88878/adobjbas.htm#462243), type inheritance, type evolution and other new features.
    2. Use REFs in 8.1.7 to build a reference-based multi-level collections (see http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a76976/adobjdes.htm#446229).
    Regards,
    Geoff

  • How to insert into more than one table at a time also..

    hi,
    i am a newbee.
    how to insert into more than one table at a time
    also
    how to get a autoincremented value of an id say transactionid for a particular accountid.
    pls assume table as
    transactionid accountid
    101 50
    102 30
    103 50
    104 35
    i want 102 for accountid 30 and 103 for accountid 50.
    thank u

    @blushadow,
    You can only insert into one table at a time. Take a look here :
    Re: insert into 2 tables
    @Raja,
    I want how to extract the last incremented value not to insert.Also, I don't understand your thread title... which was "how to insert into more than one table at a time also.. "
    Insert, extract... ? Can you clarify your job ?
    Nicolas.

  • How do i insert into more than one table from temp table?

    Hi,
    I have three tables such as temp,stck and stol
    temp table contains data as below. It has 22 columns.
    STOCK     STOCKDESC     ALIAS1     ALIAS2     ALIAS3     ALIAS4     ALIAS5     ALIAS6     ALIAS7     ALIAS8     ALIAS9     ALIAS10     ALIAS11     ALIAS12     ALIAS13     ALIAS14     ALIAS15     ALIAS16     ALIAS17     ALIAS18     ALIAS19     ALIAS20
    bmg667691031      NOWE FINANSE LTD     yy     zz     B282DV3      TESTICKER      te     te1     bmg667691031BM     te     707943W     ex     IR-PRIME     IR-ALTID     IR-BLOOM     NT-PRIME     NT-ALTID     NT-BLOOM     AU-PRIME     AU-ALTID     AU-BLOOM     mm
    AA0098000181      UFACEX HOLDINGS VAR RT DUE 06-30-2010     kk     yy     mm     TESTICKER      aa     ff     AA0098000181GB     bb     031969W     cc     IR-PRIME     IR-ALTID     IR-BLOOM     NT-PRIME     NT-ALTID     NT-BLOOM     AU-PRIME     AU-ALTID     AU-BLOOM     ba
    AC1350Z7M923      CDA GOVT TREAS BILLS CDS- 08-05-2010     ee     ff     gg     TESTICKER      hh     ij     AC1350Z7M923CA     mn     1A1MTLU     op     IR-PRIME     IR-ALTID     IR-BLOOM     NT-PRIME     NT-ALTID     NT-BLOOM     AU-PRIME     AU-ALTID     AU-BLOOM     op
    stck table contains as below.It has six columns. But always first three columns will have values.
    stock_id   stock_code stock_description              stock_type terriory_code preferred code
    1185072     AED                    
    1185073     ARA     CURRENCY ARGENTINA PESO               
    1185074     ATS     CURRENCY AUSTRIAN SCHS     
    stol table contains as below. It has 6 columns.Terriory_code is always empty.
    stock_code        territory_code    stol_type stock_id  stck_code_type sys_entry_date
    AED          0 1185072     0     6/22/2007 3:59:13.000 PM
    ARA          0 1185073     0     6/22/2007 3:59:13.000 PM
    ATS          0     1185074     0     6/22/2007 3:59:13.000 PM
    Now, i want to insert into stck and stol table based on temp table records. constraints to insert into stck and stol tables are as below
    In temp table first column is called stock. This stock has to compare with stck table stock_code. If it is not present in stck table, then it has to insert into stck table with stock_id and stock_description. Here, I need to generate stock_id my self in the code.
    In temp table, column 3 to column 22, i have alias. Each column has to check with stol table stock_code column. For instance, column3 check with stock_code column. Then column4 check with stock_code. If stock_code is not present in stol table, then i have to insert into stol table.
    I need to generate stock,id in the code. How do i perform this insertion?
    Edited by: user12852882 on Jun 12, 2010 2:37 AM

    It can be done using SQL (no loops required)
    insert into stock_table (stock_id,stock_code,stock_description)
    select stock_id,get_stock_code,stockdesc  /* get_stock_code is a function providing stock_code - usually a sequence value */
      from (select t.stock stock_id,t.stockdesc,s.stock_id stock_stock_id
              from temp_table t,stock_table s
             where t.stock = s.stock_id(+)
    where s.stock_id is null;
    insert into stol_table (stock_code,sys_entry_date) /* not clear where other values to be inserted will come from */
    select stock_code,sysdate
      from (select t.stock_code,s.stock_code stol_stock_code
              from (select distinct stock_code
                      from (select alias1 stock_code from temp_table union all
                            select alias2 from temp_table union all
                            select alias3 from temp_table union all
                            select alias4 from temp_table union all
                            select alias5 from temp_table union all
                            select alias6 from temp_table union all
                            select alias7 from temp_table union all
                            select alias8 from temp_table union all
                            select alias9 from temp_table union all
                            select alias10 from temp_table union all
                            select alias11 from temp_table union all
                            select alias12 from temp_table union all
                            select alias13 from temp_table union all
                            select alias14 from temp_table union all
                            select alias15 from temp_table union all
                            select alias16 from temp_table union all
                            select alias17 from temp_table union all
                            select alias18 from temp_table union all
                            select alias19 from temp_table union all
                            select alias20 from temp_table
                           )                                           /* use unpivot instead if you are 11g */
                     where stock_code is not null
                   ) t,stol_table s
             where t.stock_code = s.stock_code(+)
    where s.stock_code is null;
    and think about damorgan's post, you'll never regret it (especially when you will not just think)
    Regards
    Etbin

  • Trigger on a paritioned table to insert into a non-paritioned table

    Hi,
    I have a partitioned table which will have a high degree of concurrent DMLs (Updates). It has a initrans value set to 16. On this table a trigger is created which will insert into a non-partitioned table on update of highly updateable columns. I am planning to keep the initrans value and freelists value to 16 so that it does not serialize and wait for the block slots.
    Is the above set up performance inefficient? Is partitioning the table in which the trigger inserts will improve the performance?
    Thanks,
    Rajesh

    I think if you want to consider an efficient solution, I would look at not implementing your requirements using triggers. If possible consider an API approach where whatever "applicaiton" is being used calls a PL/SQL package that will update both tables if necessary. There are a number of disadvantages to using triggers.
    HTH!
    Edited by: Centinul on Jan 2, 2009 11:48 PM
    Check out this recent thread on triggers: Should one really avoid triggers???

  • ORA-01776: cannot modify more than one base table through a join view

    I have created EO based on a database view than consists of two tables, and only one is updateable.
    When I try to update a row using EO, I got a following message: "ORA-01776-cannot modify more than one base table through a join view"
    In Forms, this issue is resolved by setting "Query Only" property of non-updateable items to "True".
    Is it possible to do something like that in ADF BC?
    Thanks

    Thanks for answer.
    When I set "updateable" property to "Never", that attribute is protected from any change.
    I'm sorry for incomplete usecase.
    I have set up a list of value on that attribute, because it is a lookup field for another table and I need to get an ID from that table.
    Basically, I need that attribute to be updateble for BC, but not for database.
    Edited by: MarioK on Oct 13, 2011 9:28 AM

  • Cannot modify more than one base table through a join view

    hi guys, my current problem is that i have a datablock based on a view, now all the fields bar 1 are updateable, but this one field that is obtained through a join is displayed, the user can enter data in this field which then pupulates other fields which are required, but this specific field should not be updated. Is there an option to state this as i keep getting the error:
    cannot modify more than one base table through a join view
    Any help would be greatly appreciated, thanks.

    the user can enter data in this field which then pupulates other fields So, using the value of "this field" you then query the rest of the fields? Can you show us the code you use to populate the rest of the fields?
    but this specific field should not be updatedHave you tried setting the "Query Only" property of the field to "Yes" and the other DML properties (Ins, Upd, Del) to No?
    Also, what is your Forms version?
    Thanks,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • The best way to insert values in a Nested Table

    Hi!
    I want to insert values from a SQL-query in a Nested Table.What's the best way to do it?
    In addition,the only way that I've found is doing a query and when I've got the query result I insert it into the Nested Table.For instance:
    FOR cur_row IN (SELECT id,nstreet from example Where id=3) LOOP
    --here I'm inserting the values of the query in the nested table.
    -- VarNestedTable is a Nested Table of Row_Type.
    --Row_Type is an object with two fields:Id,Nstreet
    VarNestedTable.extend;
    VarNestedTable(Coincidents.Last):= Row_type(cur_row.id,cur_row.nstreet);
    END LOOP;

    How to Use Tables: Creating a Table Model.
    very bad example:
    class DataObject {
    String name, age, numberOfMonkeys;
    class DOTableModel extends AbstractTableModel {
      final String[] COLUMN_HEADER = { "Name", "Age", Monkeys" };
      List dataObjects;
      public String getColumnName(int column)  {
         return COLUMN_HEADER[ column ];
      public int getRowCount() {
        return dataObjects.size();
      public int getColumnCount() {
         return COLUMN_HEADER.size();
      public Object getValueAt(int row, int column) {
         DataObject do = dataObject.get( row );
         switch( column ) {
           case 0: return do.name;
           case 1: return do.age;
           case 2: return do.numberOfMonkeys;
    }

  • Insert into sap r/3 table

    hi,guruvulu
    this is the program...............to insert the data into sap r/3 table
    but record is not inserting....any commit i have to write in my program?
    Created on Feb 20, 2007
    TODO To change the template for this generated file go to
    Window - Preferences - Java - Code Style - Code Templates
    package comm;
    @author sapusr006
    TODO To change the template for this generated type comment go to
    Window - Preferences - Java - Code Style - Code Templates
    Example2.java
    Property of SAP AG, Walldorf
    (c) Copyright SAP AG, Walldorf, 2000-2005.
    All rights reserved.
    //import java.sql.Connection;
    //import java.sql.PreparedStatement;
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.IRepository;
    import com.sap.mw.jco.JCO;
    @version 1.0
    @author  SAP AG, Walldorf
    public class Fm {
      // The MySAP.com system we gonna be using
         static final String SID = "R3";
    // static String query="insert into BAPI_COMPANYCODE_GETLIST values(?,?)";
      // The repository we will be using
      IRepository repository;
                                 //ESTABLISHING A CONNECTION TO SAP
      public Fm()
        try {
          JCO.addClientPool( SID,            // Alias for this pool
                             10,             // Max. number of connections
                             "800",          // SAP client
                             "RFCTEST",      // userid
                             "welcome",      // password
                             "EN",           // language
                             "10.10.88.170", // host name
                             "01" );
           //   Create a new repository
          //    The repository caches the function and structure definitions
          //    to be used for all calls to the system SID. The creation of
          //    redundant instances cause performance and memory waste.
            repository = JCO.createRepository("MYRepository", SID);
        catch (JCO.Exception ex) {
          System.out.println("Caught an exception: \n" + ex);
                               // RETRIEVES AND DISPLAY A  ZHR INFOTYPE OPERATION
      public void salesOrders()
        JCO.Client client = null;
        try {
          // Get a function template from the repository
             //System.out.println("goes to sales order");
          IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZHR_INFOTYPE_OPERATION");
          System.out.println("hai");
               if(ftemplate != null) {
            // Create a function from the template
           JCO.Function function = ftemplate.getFunction();
           JCO.ParameterList paralist=function.getImportParameterList();
                             paralist.setValue("0000000011","PERNR");
                             paralist.setValue("UPD","ACTIO");
                             paralist.setValue("A","TCLAS");
                             System.out.println("hello");
                             paralist.setValue("20061215","BEGDA");
                             System.out.println("hello");
                             paralist.setValue("20061215","ENDDA");
                             paralist.setValue("1","OBJPS");
                             paralist.setValue("LTA","SUBTY");
              System.out.println("SETTING VALUES");
            // Get a client from the pool
              client = JCO.getClient(SID);
              System.out.println("goes to sales order");
              //function.getImportParameterList().setValue("QUERY_TABLE","ZHRJ2EETEST");
                //EXECUTING THE FUNCTION
               client.execute(function);
              System.out.println("after exeucting the function");
                 // NO OF IMPORT PARAMS IT DISPLAY
                             //STRUCTURE
                              JCO.Structure returnStructure =
                                                                              function.getExportParameterList().getStructure("RETURN");
                              String structure=returnStructure.toString();
                              System.out.println(structure);
                                                                                    JCO.Table sales_orders = function.getTableParameterList().getTable("PROPOSED_VALUES");
                             System.out.println("after function");
                               System.out.println("proposed111"+sales_orders.getNumRows());
                                                                                    sales_orders.firstRow();
                                    sales_orders.appendRows(3);
                                 sales_orders.setValue("0582","INFTY");
                                 sales_orders.setValue("P0582-AMTEX","FNAME");
                                  sales_orders.setValue("200.00","FVAL");
                                  sales_orders.nextRow();
                                  sales_orders.setValue("0582","INFTY");
                                  sales_orders.setValue("P0582-JBGDT","FNAME");
                                  sales_orders.setValue("20061215","FVAL");
                                  sales_orders.nextRow();
                                  sales_orders.setValue("0582","INFTY");
                                  sales_orders.setValue("P0582-JENDT","FNAME");
                                  sales_orders.setValue("20061215","FVAL");
                                  System.out.println("proposed222"+sales_orders.getNumRows());
                                                                                    /*for (int i = 0; i <sales_orders.getNumRows(); i++) {
                                  sales_orders.setRow(i);
                                  System.out.println(sales_orders.getString("INFTY"));
                     JCO.Table sales_orders1 = function.getTableParameterList().getTable("MODIFIED_KEYS");
                             System.out.println("modified"+sales_orders1.getNumRows());
                                                                                    sales_orders1.setRow(1);
                               sales_orders1.appendRows(1);
                               sales_orders1.setValue("0000000011","PERNR");
                               sales_orders1.setValue("0582","INFTY");
                               sales_orders1.setValue("LTA","SUBTY");
                               sales_orders1.setValue("1","OBJPS");
                               sales_orders1.setValue("20061215","BEGDA");
                               sales_orders1.setValue("20061215","ENDDA");
                             System.out.println("modified222"+sales_orders1.getNumRows());
                                                                                    System.out.println("execute222"+sales_orders1.getNumRows());
                                                                                    for (int i = 0; i <sales_orders1.getNumRows(); i++) {
                                  sales_orders.setRow(i);
                                  System.out.println("hia"+sales_orders1.getString("SUBTY"));
                                                                                    System.out.println("NO OF ROWS ARE:---"+ sales_orders.getNumRows());
               String fieldName[]=new String[sales_orders.getFieldCount()];
               System.out.println("THE COLUMNS IN THE TABLE ARE:--"+sales_orders.getFieldCount());
               // sales_orders.firstRow();
               //COLUMNS NAMES
               System.out.println(fieldName.length);
               for (int iCtrst = 0;iCtrst < sales_orders1.getFieldCount();iCtrst++) {
                        fieldName[iCtrst] = sales_orders1.getName(iCtrst);
                        System.out.println(fieldName[iCtrst]);
            if (sales_orders.getNumRows() > 0) {
              // Loop over all rows
               do {
                     System.out.println("----
                     //int r=1;
                // Loop over all columns in the current row
                for (JCO.FieldIterator e = sales_orders.fields(); e.hasMoreElements();)
                       JCO.Field field = e.nextField();
                       String compcode=field.getString();
                       //pst.setString(r,compcode);
                       System.out.println(field.getName() + ":\t" + field.getString());
                      // r++;
                   }//for
                    // i=pst.executeUpdate();
                } while(sales_orders.nextRow());
            else {
              System.out.println("No results found");
            if (sales_orders1.getNumRows() > 0) {
                // Loop over all rows
                 do {
                       System.out.println("----
                       //int r=1;
                  // Loop over all columns in the current row
                  for (JCO.FieldIterator e = sales_orders1.fields(); e.hasMoreElements();)
                             JCO.Field field1 = e.nextField();
                         //String compcode=field1.getString();
                         //pst.setString(r,compcode);
                         System.out.println(field1.getName() + ":\t" + field1.getString());
                        // r++;
                                                                                    }//for
                      // i=pst.executeUpdate();
                  } while(sales_orders1.nextRow());
              else {
                System.out.println("No results found");
               System.out.println("modified"+sales_orders1.getNumRows());
               System.out.println("modified"+sales_orders.getNumRows());
            //if
           /* if(i>=1)
                 System.out.println("\t\t\tUpdated ORACLE successfully");
          else {
            System.out.println("FUNCTION MODULE not found in backend system.");
          }//if
        catch (JCO.AbapException ex) {
          System.out.println("Caught an exception: \n" + ex);
        }catch(Exception en){en.printStackTrace();}
        finally {
                   JCO.releaseClient(client);
      protected void cleanUp() {
          JCO.removeClientPool(SID);
      public static void main(String[] argv)
        Fm e=new Fm();
       // e.systemInfo();
        e.salesOrders();
        e.cleanUp();
    output:
    TABLE: MODIFIED_KEYS
    TABLE: PROPOSED_VALUES
    IMPORT         ACTIO
    IMPORT         BEGDA
    IMPORT         DIALOG_MODE
    IMPORT         ENDDA
    IMPORT         LUW_MODE
    IMPORT         MASSN
    IMPORT         NO_ENQUEUE
    IMPORT         NO_EXISTENCE_CHECK
    IMPORT         OBJPS
    IMPORT         PERNR
    IMPORT         PERSG
    IMPORT         PERSK
    IMPORT         PLANS
    IMPORT         SEQNR
    IMPORT         SPRPS
    IMPORT         SUBTY
    IMPORT         TCLAS
    IMPORT         WERKS
    EXPORT          HR_RETURN
    EXPORT          RETURN
    EXPORT          RETURN1
    appending
    NO OF ROWS ARE:---3
    THE COLUMNS IN THE TABLE ARE:--4
    INFTY:     0582
    FNAME:     P0582-AMTEX
    FVAL:     200.00
    SEQNR:     00
    INFTY:     0582
    FNAME:     P0582-JBGDT
    FVAL:     20061215
    SEQNR:     00
    INFTY:     0582
    FNAME:     P0582-JENDT
    FVAL:     20061215
    SEQNR:     00
    PERNR:     00000011
    INFTY:     0582
    SUBTY:     LTA
    OBJPS:     1
    SPRPS:     
    ENDDA:     2006-12-15
    BEGDA:     2006-12-15
    SEQNR:     000

    hi jagadesh,
    ur code is very length to see.
    see the following code ,
    JCO.Function objFunction =
                   this
                        .objIRepository
                        .getFunctionTemplate("BAPI_MATERIAL_AVAILABILITY")
                        .getFunction();
              objFunction.getImportParameterList().setValue(strPlant, "PLANT");
              objFunction.getImportParameterList().setValue(strMaterial, "MATERIAL");
              objFunction.getImportParameterList().setValue(strQuantity, "UNIT");
              this.objClient.execute(objFunction);
              JCO.Structure ret =
                   objFunction.getExportParameterList().getStructure("RETURN");
              String strRetMsg = ret.getString("MESSAGE");
    System.out.println(strRetMsg);  // it will tell whether record is inserted or not
    /*JCO.Function objFunction1 =
                   this
                        .objIRepository
                        .getFunctionTemplate("BAPI_TRANSACTION_COMMIT")
                        .getFunction();
    objFunction1.setValue("",WAIT);
    objClient.execute(objFunction1);*/
    CHECK THE RETURN MSG .IT WILL TELL THE PROBLEM
    give me points if it is useful
    regards
    Guru
    Message was edited by:
            Guruvulu Bojja
    Message was edited by:
            Guruvulu Bojja
    Message was edited by:
            Guruvulu Bojja

  • Insert / update data to a table through DBLINK (oracle)

    I try to insert / update a table from one instance of oracle database to another one through oracle dblink, get following error:
    java.sql.SQLException: ORA-01008: not all variables bound
    ORA-02063: preceding line from MYLINK
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2152)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2035)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2876)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
    The same code to insert / update the exact same table in local instance works fine.No any binding problem. So i am pretty sure all ? mark in SQL are set with some value before sending to Oracle.
    Someone please advise what is possible problem. Db link is not set correctly? or we can not update remote table by dblink.
    By the way i can do insert / update from TOAD to the remote table through DBLINK. Problem happens only in Java code.
    thanks!
    Gary

    dblink links from one database instance to another.
    So it is certainly a source of possible problems when it works on one database and not another.
    You should start by looking at the dblink and it possible testing it in the database not via java.
    Note as well that that error suggests that it is coming from the Oracle database. I believe if you had a bind parameter problem in your java code that the error would come from the driver. But that is a guess on my part.

  • Pl/sql block with "insert into" and schema qualified table throws "error"

    Simplified test case:
    Oracle9i EE Release 9.2.0.3.0
    Oracle JDeveloper 9.0.3.2 Build 1145
    create user u1 identified by u1
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u1;
    revoke unlimited tablespace from u1;
    create user u2 identified by u2
    default tablespace users
    quota unlimited on users;
    grant connect, resource to u2;
    revoke unlimited tablespace from u2;
    As user u2:
    create table u2.t
    c1 number
    grant select, update, insert, delete on u2.t to u1;
    As user u1:
    create or replace package test_pkg as
    procedure do_insert (p_in number);
    end;
    create or replace package body test_pkg as
    procedure do_insert (p_in number) is
    begin
    insert into u2.t values (p_in);
    commit;
    end;
    end;
    All of the above works fine using command-line sql*plus, and is clearly a simplified version of the actual code to demonstrate the issue at hand. Using JDeveloper, it complains about 'expected ;' at the 'values' keyword in the insert statement. Removing the schema qualification from the table name allows JDeveloper to not flag the statement as an error, but I do not want to create synonyms (private or public) to point to all the tables in the real packages. Since JDeveloper flags the insert statement as an error, I can not browse the package structure etc, even though it compiles with no problems. What gives?
    Thanks in advance for any suggestions, etc...

    Hi Bryan,
    Thanks for following up on this. I will look for the bug fix to be published.
    - Mark

  • Data from 2 database blocks insert into the same base table?

    Hello,
    I have canvas C_NEW. On this canvas, items from 3 blocks are usable by the user.
    1. Block NEW_HEAD: 3 items say X1,X2,X3
    2. Block NEW : multi record text fields say Y1 thru Y10. Also a scrollbar.
    3. Block NEW_ACTION: 6 buttons say B1 thru B6 (One of them is N_OK which is the item in question)
    both the blocks NEW, NEW_HEAD are db blocks and have the same base table say BT. When the users click on the N_OK (after filling out the data in the NEW_HEAD block and then NEW in that order) I need the data from both the NEW, NEW_HEAD to go into the BT. Currently only the data from the NEW is going into BT. Fields in the BT table which correspond to the fields X1,X2,X3 in the NEW_HEAD remain null after clicking the N_OK button. I put commit_form in the N_OK code since both the blocks are db blocks( and as suggested by folks, it is easier to issue a commit_form than do a lot more work in writing my own SQL).
    How can I achive this?
    Thanks,
    Chiru

    I tried doing what you suggested by putting the following code in the program unit which gets called when_button_pressed.
    PROCEDURE P_SAVE IS
    v_lc_no number;
    v_lc_seq number;
    v_dmg_allow number;
    BEGIN
      Go_Block('B_new_head');
      v_lc_no:= :B_new_head.N_LC_NO;
      v_lc_seq:= :B_new_head.N_LC_SEQ;
      v_dmg_allow:= :B_new_head.N_LC_DMG_ALLOW;
      Go_Block('B_new');      
    FIRST_RECORD;
    LOOP     
         emessage('before insert'||v_lc_no||'-'||v_lc_seq||'-'||:B_new.order_no);
      INSERT INTO ct_lc_import(
        LC_NUMBER,
        LC_SEQ,
        DAMAGE_ALLOWANCE,
        ORDER_NO,
        QTY_SHIPPED,
        UNIT_PRICE,
        DRAFT_AMOUNT,
        TICKET_DEDUCTION,
        SHIPMENT_PENALTY,
        TOTAL_DEBIT,
        DEBIT_DATE)
        VALUES (v_lc_no,
                v_lc_seq,
                v_dmg_allow,
                :B_new.order_no,
                :B_new.qty_shipped,
                :B_new.unit_price,
                :B_new.draft_amount,
                :B_new.ticket_deduction,
                :B_new.shipment_penalty,
                :B_new.total_debit,
                :B_new.debit_date);
       commit;
      NEXT_RECORD;
       if :SYSTEM.LAST_RECORD='TRUE' then
             emessage('last record');
             EXIT;
       end if;
      --NEXT_RECORD;
    END LOOP;
    EXCEPTION
       when FORM_TRIGGER_FAILURE then
          raise;
       when OTHERS then
          emessage(SQLERRM);
          raise FORM_TRIGGER_FAILURE;
    END;But I can't see the records in the table eventhough the message pops up with the values before inserting the 1st record. It then exits. I would think it would atleast insert the very first record into the the table at the least.
    Thanks,
    Chiru

  • HOw to improve insert/update/select  for nested table.

    Hi All,
    I think this is my second thread for nested table.
    i just want to know what are the different ways available to improve the insert/update/select operation on Nested table.
    Thanks in advance.

    By not using a nested table for data storage in the first place...
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:8135488196597
    Perhaps Parallel Query/DML might give some relief.

  • Decide to insert into one or another table

    Hi guys,
    I have the following problem:
    Need to run a process which inserts records into TABLE A (COL1, COL2, COL3), but then if COL3 = 3 then I have to insert the current record in TABLE B without inserting in table A.
    Table A = Table B in structure.
    I cannot modify the process to do this as I will loose my warranty period, so I think it can be possible to do it by triggers, as I thought in "INSTEAD OF" but this solution only apply (I guess) to views.
    Any clues?
    Thanks in Advance.
    -Ed

    I figured out this code. The only thing is that is crying for the null insert (ORA-01400 cannot insert null).
    What I want to see is if this error will cut the insertion process as a whole.
    Let me know your comments please and thanks for help.
    CREATE OR REPLACE TRIGGER SCOTT.TRG_INDICES_INS
    BEFORE INSERT
    ON SCOTT.INDICES
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    falla EXCEPTION;
    pragma AUTONOMOUS_TRANSACTION;
    BEGIN
    IF :NEW.col1 = 1
    THEN
    RAISE falla;
    END IF;
    EXCEPTION
    WHEN falla
    THEN
    INSERT INTO asoc
    VALUES (:NEW.col1, :NEW.col2, :NEW.col3);
         COMMIT;
         :NEW.COL1:=NULL;
    -- INDICES TABLE ATTRIBUTES CANNOT BE NULL
    WHEN OTHERS
    THEN
    null;
    END trg_indices_ins;

  • Retriving unique records and insert into cust and cust_det table

    Hi,
    uniq Table : EMP
    column name
    name
    addr
    city
    addr1
    city1
    EMP table contains only unique records.
    we neet to get the records from emp and insert into cust and cust_det accordingly
    table : cust
    empno : auto generated
    name
    addr
    tabel : cust_det
    empno : refer from cust
    addr1
    city1
    plese help me to do this.

    user10069916 wrote:
    can some one help me to resolve this plz. bit urgent..My boss says my work is more urgent than yours.
    As I said, please read: {message:id=9360002} (especially point 2)
    If you post sufficient information, then people can help you. the better the information you provide the faster people will be able to help... but still, if it's "urgent" then we can only assume you have a live production system that is failing, in which case you need to raise an SR with Oracle Support, as the forums are not the place for logging "urgent" production system issues.

Maybe you are looking for

  • Unable to create or modify SAP APO Bex Query

    Hi Experts, I am using Bex for creating report on APO Cube. But when I am trying to create a new query including Restricted Key Figures or calculated Key Figures, then I am getting error " The query Could not saved due to problem in Transport". I tri

  • Folder size in Bridge CS6

    How do I find the size of a folder (not file) in Bridge CS6

  • Dynamic End Point Lookup in BPEL from Oracle Service Registry

    Hi, I have configured the OSR as mentioned in the configuration document, http://download-east.oracle.com/docs/cd/B31017_01/integrate.1013/b28982/service_config.htm#BABBHJAF I am able to connect to the OSR using JDeveloper in BPEL Project, but when I

  • SQL Developer to Oracle 8 database

    Hello, I am trying to connect to an Oracle 8 database using SQL Developer on a Windows 7 64bit PC. I tried SQL Developer version 1.5 but then read that it cannot connect to databases earlier than version 9. I then got a copy of SQL Developer version

  • Dimension with multiple leafs

    Hello, We want to set up the following hierarchy: --- OXN ....|--- POT ....|....\--- RST ....| ....\--- OIN .........\--- PJT ..............\--- RST So this means OXN has 2 child levels (POT&OIN) and RST has 2 parent levels (PJT&POT) Now when we make