Skip to content

rafli-ramadhan/spring-jdbc-oracle-example-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring-jdbc-oracle-example-crud

Database query

CREATE TABLE content ( id NUMBER(19) NOT NULL, content_id VARCHAR2(255) UNIQUE NOT NULL, content_message VARCHAR2(255), is_delete NUMBER(1) DEFAULT 0, created_date TIMESTAMP DEFAULT SYSTIMESTAMP, updated_date TIMESTAMP DEFAULT SYSTIMESTAMP, CONSTRAINT content PRIMARY KEY (id) ); DROP TABLE content; select * from content; CREATE SEQUENCE content_id_seq START WITH 1; DROP SEQUENCE id_seq; DROP SEQUENCE content_id_seq; CREATE SEQUENCE id_seq START WITH 1; CREATE SEQUENCE content_id_seq START WITH 1 INCREMENT BY 1; CREATE OR REPLACE TRIGGER id_trigger BEFORE INSERT ON content FOR EACH ROW BEGIN	:NEW.id := id_seq.NEXTVAL; END; CREATE OR REPLACE TRIGGER content_id_trigger BEFORE INSERT ON content FOR EACH ROW BEGIN	:NEW.content_id := 'content-' || content_id_seq.NEXTVAL; -- IF :NEW.content_id = 'content-' THEN -- :NEW.content_id := :NEW.content_id || content_seq.NEXTVAL; -- ELSE -- RAISE_APPLICATION_ERROR(-20001, 'Unknown content type: ' || :NEW.content_id); -- END IF; END; truncate content; select * from content; INSERT INTO content(content_id, content_message, is_delete) VALUES ('content-', 'Thank you for your order! Your order #{order_number} has been confirmed and will be shipped on {shipping_date}.', 0); 

About

Spring JDBC with Oracle integration: CRUD example

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published