Search

Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Thursday, 26 April 2012

Script: Create Nested Table

CREATE TYPE MISO AS OBJECT
(PRODID NUMBER(5), PRICE NUMBER(7,2));

CREATE TYPE MISOTYPE AS TABLE OF MISO;

CREATE TABLE PORDER(
ORDID NUMBER(5),
SUPPLIER NUMBER(5),
REQUESTER NUMBER(4),
ORDERED DATE,
ITEMS MISOTYPE)
NESTED TABLE ITEMS STORE AS STG_TAB;

INSERT INTO PORDER
VALUES(1253,1002,100,'01-APR-10', MISOTYPE(
MISO(155,555),
MISO(156,566),
MISO(157, 577)));


select t1.ORDID, t2.prodid
from porder t1, table(t1.items) t2

0 comments:

Post a Comment