Yes I believe I understand you are running 10 separate statements and using the Toad function to convert select statements to save a backups to replace the data should you need to.
I am not sure if this function seemingly designed for the conversion a single data set into one that will fulfill your requirement of 10 statements.
That being said I created and populated the data for first two scripts to create your insert statements that you could spool to a file for backup. I
Unless you find a way to get the function to work like you want, I offer this as alternative.
If you decide to try to convert the others I suggest you add a field at a time(in the values) to make sure all the quoted character type fields have a single preceding and trailing quote and without messing up prior ones. It can be a bit tricky.
Good luck
- EMPLOYEES
select ‘insert into employees (emp_id, emp_name, location) values (’ ||
emp_id || ‘,’’’ || emp_name || ‘’’,’’’ || location || ‘’’);’
from employees
where location = ‘FL’;
OUTPUT: This matches your example and inserted without issue.
insert into employees (emp_id, emp_name, location) values (001,‘abcd’,‘FL’);
insert into employees (emp_id, emp_name, location) values (002,‘efgh’,‘FL’);
- EMP_DATA: This one is more complex due to the date fields.
select ‘insert into emp_data (emp_id, fst_name, lst_name, dob, doj, sal, location) values (’ ||
emp_id || ‘,’’’ || fst_name || ‘’’,’’’ || lst_name || ‘’’, to_date(’’’ || to_char(dob, ‘MM/DD/YYYY’) ||
‘’’,’‘MM/DD/YYYY’’), to_date(’’’ || to_char(doj, ‘MM/DD/YYYY’) || ‘’’,’‘MM/DD/YYYY’’), ’ || sal || ‘, ‘’’ || location || ‘’’);’
from emp_data
where location = ‘FL’;
OUTPUT: inserted without issue
insert into emp_data (emp_id, fst_name, lst_name, dob, doj, sal, location) values (001,‘abcd’,‘efgh’, to_date(‘01/01/1980’,‘MM/DD/YYYY’), to_date(‘01/01/2001’,‘MM/DD/YYYY’), 5000, ‘FL’);
insert into emp_data (emp_id, fst_name, lst_name, dob, doj, sal, location) values (002,‘efgh’,‘ijcl’, to_date(‘01/01/1985’,‘MM/DD/YYYY’), to_date(‘01/07/2012’,‘MM/DD/YYYY’), 2500, ‘FL’);