text: /* Formatted on 10/6/2014 7:54:31 PM (QP5 v5.126.903.23003) */
  -- TABLE: INV.INV_CONSGMT_RCPT_RTNS_DET
  
  -- DROP TABLE INV.INV_CONSGMT_RCPT_RTNS_DET;
  
  CREATE TABLE INV.INV_CONSGMT_RCPT_RTNS_DET (
     LINE_ID            NUMBER NOT NULL,
     CONSGMT_ID         NUMBER,
     RTNS_HDR_ID        NUMBER,
     QTY_RTND           NUMBER,
     CREATED_BY         NUMBER,
     CREATION_DATE      VARCHAR2 (21 BYTE),
     LAST_UPDATE_BY     NUMBER,
     LAST_UPDATE_DATE   VARCHAR2 (21 BYTE),
     RTND_REASON        CLOB,
     REMARKS            CLOB,
     RCPT_LINE_ID       NUMBER,
     ITM_ID             NUMBER,
     SUBINV_ID          NUMBER,
     STOCK_ID           NUMBER
  )
  TABLESPACE RHODB
  PCTUSED 0
  PCTFREE 10
  INITRANS 1
  MAXTRANS 255
  STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
  LOGGING
  NOCOMPRESS
  NOCACHE
  NOPARALLEL
  MONITORING;
  
  ALTER TABLE INV.INV_CONSGMT_RCPT_RTNS_DET
  ADD(CONSTRAINT PK_RCPT_RTNS_DET PRIMARY KEY (LINE_ID ));
  
  
  -- INDEX: INV.IDX_CONSGMT_ID4
  
  -- DROP INDEX INV.IDX_CONSGMT_ID4;
  
  CREATE INDEX INV.IDX_CONSGMT_ID4
     ON INV.INV_CONSGMT_RCPT_RTNS_DET (CONSGMT_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  -- INDEX: INV.IDX_ITM_ID1
  
  -- DROP INDEX INV.IDX_ITM_ID1;
  
  CREATE INDEX INV.IDX_ITM_ID1
     ON INV.INV_CONSGMT_RCPT_RTNS_DET (ITM_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
     /*
  -- INDEX: INV.IDX_LINE_ID3
  
  -- DROP INDEX INV.IDX_LINE_ID3;
  
  CREATE UNIQUE INDEX INV.IDX_LINE_ID3
     ON INV.INV_CONSGMT_RCPT_RTNS_DET (LINE_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  */
  -- INDEX: INV.IDX_RCPT_LINE_ID
  
  -- DROP INDEX INV.IDX_RCPT_LINE_ID;
  
  CREATE INDEX INV.IDX_RCPT_LINE_ID
     ON INV.INV_CONSGMT_RCPT_RTNS_DET (RCPT_LINE_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  -- INDEX: INV.IDX_RTNS_HDR_ID
  
  -- DROP INDEX INV.IDX_RTNS_HDR_ID;
  
  CREATE INDEX INV.IDX_RTNS_HDR_ID
     ON INV.INV_CONSGMT_RCPT_RTNS_DET (RTNS_HDR_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  -- INDEX: INV.IDX_STOCK_ID
  
  -- DROP INDEX INV.IDX_STOCK_ID;
  
  CREATE INDEX INV.IDX_STOCK_ID
     ON INV.INV_CONSGMT_RCPT_RTNS_DET (STOCK_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  -- INDEX: INV.IDX_SUBINV_ID2
  
  -- DROP INDEX INV.IDX_SUBINV_ID2;
  
  CREATE INDEX INV.IDX_SUBINV_ID2
     ON INV.INV_CONSGMT_RCPT_RTNS_DET (SUBINV_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  CREATE SEQUENCE INV.INV_CONSGMT_RCPT_RTNS_DET_SEQ
     START WITH 1
     MAXVALUE 9223372036854775807
     MINVALUE 1
     NOCYCLE
     CACHE 20
     ORDER;
  
  CREATE OR REPLACE TRIGGER INV.INV_CONSGMT_RCPT_RTNS_DET_TRG
     BEFORE INSERT
     ON INV.INV_CONSGMT_RCPT_RTNS_DET
     FOR EACH ROW
     -- OPTIONALLY RESTRICT THIS TRIGGER TO FIRE ONLY WHEN REALLY NEEDED
     WHEN (NEW.LINE_ID IS NULL)
  DECLARE
     V_ID   INV.INV_CONSGMT_RCPT_RTNS_DET.LINE_ID%TYPE;
  BEGIN
     SELECT   INV.INV_CONSGMT_RCPT_RTNS_DET_SEQ.NEXTVAL INTO V_ID FROM DUAL;
  
     :NEW.LINE_ID := V_ID;
  END INV_CONSGMT_RCPT_RTNS_DET_TRG;