This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
json CLOB := 'JSON chunk 1' || 'JSON chunk 2' || 'JSON chunk 3'; | |
BEGIN | |
insert into myclobs (data, date_created) values(json, SYSDATE); | |
END; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table MYCLOBS | |
( | |
id number not null, | |
data clob, | |
date_created timestamp, | |
CONSTRAINT PK_MYCLOBS PRIMARY KEY (id) | |
); | |
-- An auto-generated sequence for the ids | |
CREATE SEQUENCE myclob_seq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Fake data generated by: http://json-generator.appspot.com/ | |
insert into myclobs (data, date_created) values (' | |
{ | |
"_id": "556e52fc21aa6202ee1aac18", | |
"index": 0, | |
"guid": "dd60b0a8-2bb8-4dae-83b4-1940b2e47f9c", | |
"isActive": false, | |
"balance": "$3,616.96", | |
"picture": "http://placehold.it/32x32", | |
"age": 40, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM myclobs | |
where dbms_lob.instr(data,'Stevenson') >= 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Fake data generated by: http://json-generator.appspot.com/ | |
insert into myclobs (data, date_created) values (to_clob('[ | |
{ | |
"_id": "556e52fc21aa6202ee1aac18", | |
"index": 0, | |
"guid": "dd60b0a8-2bb8-4dae-83b4-1940b2e47f9c", | |
"isActive": false, | |
"balance": "$3,616.96", | |
"picture": "http://placehold.it/32x32", | |
"age": 40, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER myclobs ADD CONSTRAINT ensure_json CHECK (data IS JSON); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT data.eyeColor FROM myclobs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into myclobs (data, date_created) values (‘[{ | |
"_id": "556e52fc21aa6202ee1aac18", | |
"index": 0, | |
"guid": "dd60b0a8-2bb8-4dae-83b4-1940b2e47f9c", | |
"isActive": false, | |
"balance": "$3,616.96", | |
"picture": "http://placehold.it/32x32", | |
"age": 40, | |
"eyeColor": "blue", | |
"name": "Mayra Stevenson", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Lob | |
@Column(name = "DATA") | |
private String data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create.insertInto(Book.BOOK) | |
.set(Book.BOOK.ID, 5) | |
.set(Book.BOOK.AUTHOR_ID, 1) | |
.set(Book.BOOK.TITLE, "The Idiot's Guide to Programming") | |
.execute() |