How to Auto generate Primary Key while CSV file Upload in oracle Apex

 


If you want CSV file upload in oracle apex. but its haven't PK/UNIQUE column. Without  PK column most important problem to make web application in Oracle Apex.

you can this problem solve . if you flowing my steps.


Step-1

CREATE TABLE  DEMO_DEPARTMENTS
   ( 
        NO                               NUMBER(4,0),
        DEPARTMENT_ID           NUMBER(4,0), 
DEPARTMENT_NAME      VARCHAR2(30)
);
ALTER TABLE DEMO_DEPARTMENTS
  ADD (
    CONSTRAINT DEMO_DEPARTMENTS PRIMARY KEY (NO)
  );


Step-2

CREATE  SEQUENCE SEQ_NO
 START WITH 1000
 INCREMENT BY 10;


Step-3

CREATE OR REPLACE TRIGGER SEQ_NO
  BEFORE INSERT ON DEMO_DEPARTMENTS
  FOR EACH ROW
BEGIN
  SELECT SEQ_NO.nextval
  INTO :new.NO
  FROM dual;
END;
/


Step-4

Finally you can CSV file load in Oracle Apex.






Post a Comment

Previous Post Next Post