2 Replies Latest reply: May 21, 2013 9:49 AM by rp0428 RSS

    Inserting more than one item into a nested table

    999406
      Here is my code to insert data into a nested table:

      INSERT INTO PurchaseOrder_objtab
      SELECT PurchaseOrder_objtyp(
      1008,
      REF(C),
      SYSDATE,
      '12-MAY-1999',
      (SELECT LineItemList_ntabtyp(LineItem_objtyp(1, REF(StckItem), 10, 1)) FROM Stock_objtab WHERE StockNo = 1004),
      NULL)
      FROM Customer_objtab C
      WHERE C.CustNo = 1;

      Can I please have some help for the syntax for entering more than one value into the LineItemList_ntabtyp.

      I have tried this with no luck:

      INSERT INTO PurchaseOrder_objtab
      SELECT PurchaseOrder_objtyp(
      1008,
      REF(C),
      SYSDATE,
      '12-MAY-1999',
      (SELECT LineItemList_ntabtyp(LineItem_objtyp(1, REF(StckItem), 10, 1)) FROM Stock_objtab WHERE StockNo = 1004) AND (SELECT LineItemList_ntabtyp(LineItem_objtyp(2, REF(StckItem), 10, 1)) FROM Stock_objtab WHERE StockNo = 1005),
      NULL)
      FROM Customer_objtab C
      WHERE C.CustNo = 1;
        • 1. Re: Inserting more than one item into a nested table
          Mahir M. Quluzade
          996403 wrote:
          Here is my code to insert data into a nested table:

          INSERT INTO PurchaseOrder_objtab
          SELECT PurchaseOrder_objtyp(
          1008,
          REF(C),
          SYSDATE,
          '12-MAY-1999',
          (SELECT LineItemList_ntabtyp(LineItem_objtyp(1, REF(StckItem), 10, 1)) FROM Stock_objtab WHERE StockNo = 1004),
          NULL)
          FROM Customer_objtab C
          WHERE C.CustNo = 1;

          Can I please have some help for the syntax for entering more than one value into the LineItemList_ntabtyp.

          I have tried this with no luck:

          INSERT INTO PurchaseOrder_objtab
          SELECT PurchaseOrder_objtyp(
          1008,
          REF(C),
          SYSDATE,
          '12-MAY-1999',
          (SELECT LineItemList_ntabtyp(LineItem_objtyp(1, REF(StckItem), 10, 1)) FROM Stock_objtab WHERE StockNo = 1004) AND (SELECT LineItemList_ntabtyp(LineItem_objtyp(2, REF(StckItem), 10, 1)) FROM Stock_objtab WHERE StockNo = 1005),
          NULL)
          FROM Customer_objtab C
          WHERE C.CustNo = 1;
          Hi,

          Please try, I didn't tested :
          INSERT INTO PurchaseOrder_objtab
          SELECT PurchaseOrder_objtyp(
          1008, 
          REF(C),
          SYSDATE, 
          '12-MAY-1999',
          (SELECT LINEITEMLIST_NTABTYP(LINEITEM_OBJTYP(1, REF(STCKITEM), 10, 1))
           FROM STOCK_OBJTAB WHERE STOCKNO = 1004 
           UNION ALL
           SELECT LINEITEMLIST_NTABTYP(LINEITEM_OBJTYP(2, REF(STCKITEM), 10, 1))
             FROM Stock_objtab WHERE StockNo = 1005),
          NULL)
          FROM CUSTOMER_OBJTAB C 
          WHERE C.CustNo = 1;
          • 2. Re: Inserting more than one item into a nested table
            rp0428
            DUPLICATE THREAD!

            Please don't create duplicate threads. You already have a thread for this question. Mark this new thread ANSWERED and continue using the first one.
            Re: Insert values into a nested tsble