I want to generate many SQL * Plus scripts by querying a data dictionary, but I run into some problems and suspect that I am missing something obvious.
For example, when I execute the following in SQL * Plus, I get ORA-01756: quoted string not properly terminated:
SQL> SPOOL myscript.sql
SQL> SELECT q'[SPOOL log
2 SELECT COUNT(*) FROM DUAL;
ERROR:
ORA-01756: quoted string not properly terminated
I tried using the line continuation character to avoid this error, but it puts the continuation character in the output:
SQL> SELECT q'[SPOOL log
2 SELECT COUNT(*) FROM DUAL; -
3 PROMPT Done.
4 ]' FROM DUAL;
SPOOL log
SELECT COUNT(*) FROM DUAL; -
PROMPT Done.
Notice how the output is -after DUAL;? I do not want this in the generated script.
, , - CHR() ; , , , , ]'||CHR(59)||CHR(10)||q'[, , .
( SQL * Plus Release 11.2.0.1.0 Production, 11gR2.)