Posts

Showing posts with the label ORA-01756: quoted string not properly terminated

It’s the little things in life …

Image
Sometimes you get information and you ask yourself: "Why didn't I know this? This would have made (certain) things so much easier!" or "I didn't know I could do this". Well, this just happened to me and after asking a few colleges, I found out: I’m not the only Oracle developer who didn't know this (without being too concerned about the statistical relevance of the sample size, I would estimate that about 80% of PL/SQL developers might not know this). So I decided to write this little post. Consider this piece of code: CREATE TABLE examples (sample_str VARCHAR2 (100)); INSERT INTO examples (sample_str) VALUES ('It''s the little things in life ...'); DECLARE v_stm VARCHAR2 (1000); BEGIN v_stm := 'insert into examples (sample_str) values (''It''''s the little things in life ...'')'; EXECUTE IMMEDIATE v_stm; END; Take a look at the quotation syntax. Most developers will recognize...