Advertisement
Guest User

Untitled

a guest
Nov 7th, 2023
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. CREATE TABLE "USER1"."PRODUCT"
  2. ( "ID" NUMBER(*,0) DEFAULT "USER1"."PRODUCT_SEQUENCE"."NEXTVAL" NOT NULL ENABLE,
  3. "NAME" VARCHAR2(80 BYTE) NOT NULL ENABLE,
  4. "GROUP_ID" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE,
  5. "ENTRY_PRICE" NUMBER DEFAULT 0,
  6. "RETAIL_PRICE" NUMBER DEFAULT 0,
  7. "COUNT" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE,
  8. CONSTRAINT "PRODUCT_PK" PRIMARY KEY ("ID")
  9. USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
  10. STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  11. PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  12. BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  13. TABLESPACE "USERS" ENABLE,
  14. CONSTRAINT "PRODUCT_FK1" FOREIGN KEY ("GROUP_ID")
  15. REFERENCES "USER1"."PRODUCT_GROUP" ("ID") ON DELETE CASCADE ENABLE
  16. ) SEGMENT CREATION IMMEDIATE
  17. PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  18. NOCOMPRESS LOGGING
  19. STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  20. PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  21. BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  22. TABLESPACE "USERS" ;
  23.  
  24. CREATE OR REPLACE NONEDITIONABLE TRIGGER "USER1"."UPDATE_GROUP_C_RETAIL"
  25. BEFORE UPDATE OF entry_price ON product
  26. FOR EACH ROW
  27. BEGIN
  28. UPDATE product_group
  29. SET c_retail = c_retail - (:OLD.retail_price * :OLD.count) + (:NEW.retail_price * :NEW.count)
  30. WHERE id = :NEW.group_id;
  31. END;
  32. /
  33. ALTER TRIGGER "USER1"."UPDATE_GROUP_C_RETAIL" ENABLE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement