I have a shell script which executes a pl/sql block, I'm printing output to output file but it's not keeping old information and not displaying time and date when the script was executed.
My script below.
#!/bin/bash sqlplus -s $DATABASE > output << EOSQL SET FEEDBACK ON declare veventSource varchar2(20); verrorcode integer; verrorMessage varchar2(255); begin for rec in (select substr(customer,3) as pid, substr(account_num,1,2) as countrycode from account where substr(account_num,1,2) = substr(account_num,3,2) and customernot in (select customer from custsource) ) loop veventSource := rec.countrycode||'_'||rec.pid; IPGDDL.LINKTOAC(rec.countrycode,rec.LID,veventSource, '01-JAN-1971',null,'F',null,null,null,null,null,verrorcode,verrorMessage); dbms_output.put_line(verrorcode); dbms_output.put_line(verrorMessage); commit; end loop; end; / EXIT EOSQL
After executing the script I do have a log file, which only prints
PL/SQL Procedure completed successfully.
I want sql output to be printed in output.txt file in the directory, with date and time when cron job run with this script, and also keep all the old data in the log.
Can anyone help on this please.