spool to a file with text string concatenation : SPOOL « SQL Plus « Oracle PL / SQL






spool to a file with text string concatenation

   
SQL>
SQL>
SQL> set heading off
SQL> set feedback off
SQL> set echo off
SQL>
SQL> spool tabsyns.sql
SQL>
SQL> select 'create public synonym ' || table_name ||
  2         ' for ' || table_name || ';'
  3    from user_tables
  4    where rownum < 50;


create public synonym MYTABLE_SESSION for MYTABLE_SESSION;
create public synonym DONE for DONE;
create public synonym EMP_CHANGES for EMP_CHANGES;
create public synonym AQ$_EMP_CHANGES_S for AQ$_EMP_CHANGES_S;
create public synonym AQ$_EMP_CHANGES_T for AQ$_EMP_CHANGES_T;
create public synonym AQ$_EMP_CHANGES_H for AQ$_EMP_CHANGES_H;
create public synonym COMPILE_SCHEMA_TMP for COMPILE_SCHEMA_TMP;
create public synonym TEMP_EMP for TEMP_EMP;
create public synonym UPPER_ENAME for UPPER_ENAME;
create public synonym SYS_IOT_OVER_16251 for SYS_IOT_OVER_16251;
create public synonym AQ$_EMP_CHANGES_G for AQ$_EMP_CHANGES_G;
create public synonym AQ$_EMP_CHANGES_I for AQ$_EMP_CHANGES_I;
create public synonym DEPT_AND_EMP for DEPT_AND_EMP;


create public synonym EMP_REG for EMP_REG;
create public synonym SESS_EVENT for SESS_EVENT;
create public synonym PAGES for PAGES;
SQL>
SQL> spool off
SQL> set echo on
SQL> set heading on
SQL> set feedback on
SQL>
SQL>

SQL>

   
    
  








Related examples in the same category

1.SPOOL query result to a file
2.Spooling files on and off
3.spool to report.txt replace
4.Extracts data from the emp table and writes it to a text file in a comma-delimited format