sql - Oracle PLSQL script for string concatenation -
i have database of sql queries, procedures etc.
now have following sql statement concatenation operators.
'insert test_table(id, name)' || 'select id, name ' || ' my_table'
i want when sql return
insert test_table(id, name) select id, name my_table
this sql example want remove concatenations , return simple sql.
thanks
if got question right looking eval
make oracle evaluate string concatenation marks.
try
declare concatenetaed_sql varchar2(32000); result_sql varchar2(32000); begin concatenetaed_sql := '''insert test_table(id, name)'' || ''select id, name '' || '' my_table'''; execute immediate 'select ' || concatenetaed_sql || ' dual' result_sql; dbms_output.put_line(result_sql); end;
and result
insert test_table(id, name)select id, name my_table pl/sql procedure completed.
Comments
Post a Comment