I recently had an issue where I had to use a q function inside another q function. Here's what I tried:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | DECLARE l_code varchar2(4000); BEGIN l_code := q '!BEGIN dbms_output.put_line(q' !It 's cold in Calgary!' ); END ; !'; dbms_output.put_line(l_code); execute immediate l_code; END ; / ERROR: ORA-01756: quoted string not properly terminated |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | DECLARE l_code varchar2(4000); BEGIN l_code := q '#BEGIN dbms_output.put_line(q' !It 's cold in Calgary!' ); END ; # '; dbms_output.put_line(l_code); execute immediate l_code; END; / BEGIN dbms_output.put_line(q' !It 's cold in Calgary!' ); END ; It's cold in Calgary PL/SQL procedure successfully completed. |
No comments:
Post a Comment