today:
1,157
yesterday:
2,073
Total:
1,301,060

SQL CREATING A TABLE / SEQUENCE / TRIGGER

admin 2016.04.28 13:34 Views : 286

* CREATING A TABLE  *
CREATE TABLE  "CATEGORY_T"
   (    "CA_ID" NUMBER NOT NULL ENABLE,
    "CA_NAME" VARCHAR2(50),
    "LAST_MODIFIED_ON" DATE,
    "LAST_MODIFIED_BY" VARCHAR2(30),
     CONSTRAINT "CATEGORY_PK" PRIMARY KEY ("CA_ID") ENABLE
   )
/

* CREATING SEQUENCE *
 CREATE SEQUENCE   "CATEGORY_SEQ"  MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 100 CACHE 20 NOORDER  NOCYCLE
/

* CREATING TRIGGER *
CREATE OR REPLACE TRIGGER  "INSERT_CATEGORY"
BEFORE INSERT ON CATEGORY_T
FOR EACH ROW
DECLARE
  CA_id_sv number;
BEGIN
  IF INSERTING THEN
 
  :New.LAST_MODIFIED_ON:= SYSDATE;
  :New.LAST_MODIFIED_BY:= V('APP_USER');

  SELECT CATEGORY_SEQ.nextval
    INTO CA_id_sv
    FROM dual;
  :new.CA_ID := CA_id_sv;

  ELSIF UPDATING THEN

  :New.LAST_MODIFIED_ON:= SYSDATE;
  :New.LAST_MODIFIED_BY:= V('APP_USER');

END IF;
 
End;
/
 
No. Subject Author Date Views
29 Group by, Order by (두개의 Table을 활용한 Sub Total / 최고값 ) admin 2016.05.06 375
28 EMPLOYEE_LEVEL_ID admin 2016.05.03 179
27 HEAD TITLE (제목)을 조건에 따라 바꾸기 admin 2016.05.03 216
26 APEX ADMIN PASSWORD 바꾸기 admin 2016.05.02 186
25 wwv_flow_files admin 2016.05.01 222
24 EXPORT & IMPORT admin 2016.05.01 379
23 Outer Join with Oracle SQL admin 2016.04.29 235
22 Report by Order / Product / Order and Product / By Order & Non Order admin 2016.04.29 339
21 Delimiter admin 2016.04.29 217
20 SQL SELECT DISTINCT Statement admin 2016.04.29 282
19 TAP ( Main & Sub ) / Button 의 Switch admin 2016.04.28 295
18 COUNT admin 2016.04.28 237
» CREATING A TABLE / SEQUENCE / TRIGGER admin 2016.04.28 286
16 CREATE (INSERT) PROCESS admin 2016.04.28 245
15 DELETE PROCESS admin 2016.04.28 254
14 Global & Custom Serach file admin 2016.04.28 213
13 INSERT PROCESS admin 2016.04.28 235
12 JAVA for delete admin 2016.04.28 227
11 LIST OF VALUE (DYNAMIC) admin 2016.04.28 209
10 MAX admin 2016.04.28 241