Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE "USER1"."PRODUCT"
- ( "ID" NUMBER(*,0) DEFAULT "USER1"."PRODUCT_SEQUENCE"."NEXTVAL" NOT NULL ENABLE,
- "NAME" VARCHAR2(80 BYTE) NOT NULL ENABLE,
- "GROUP_ID" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE,
- "ENTRY_PRICE" NUMBER DEFAULT 0,
- "RETAIL_PRICE" NUMBER DEFAULT 0,
- "COUNT" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE,
- CONSTRAINT "PRODUCT_PK" PRIMARY KEY ("ID")
- USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
- STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
- PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
- BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
- TABLESPACE "USERS" ENABLE,
- CONSTRAINT "PRODUCT_FK1" FOREIGN KEY ("GROUP_ID")
- REFERENCES "USER1"."PRODUCT_GROUP" ("ID") ON DELETE CASCADE ENABLE
- ) SEGMENT CREATION IMMEDIATE
- PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
- NOCOMPRESS LOGGING
- STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
- PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
- BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
- TABLESPACE "USERS" ;
- CREATE OR REPLACE NONEDITIONABLE TRIGGER "USER1"."UPDATE_GROUP_C_RETAIL"
- BEFORE UPDATE OF entry_price ON product
- FOR EACH ROW
- BEGIN
- UPDATE product_group
- SET c_retail = c_retail - (:OLD.retail_price * :OLD.count) + (:NEW.retail_price * :NEW.count)
- WHERE id = :NEW.group_id;
- END;
- /
- ALTER TRIGGER "USER1"."UPDATE_GROUP_C_RETAIL" ENABLE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement