Using spool command we can generate output files in client machine:
SQL>conn manjit/manjit;
connected
SQL> Spool on
SQL> set heading off <===
SQL> Spool /oradata/backup/spooltext.txt
SQL> Query(sql query)
SQL> Spool off
We create a file in D:\External_Tables named emp_query.sql with the following saved query.
SQL>conn manjit/manjit;
connected
SQL> Spool on
SQL> set heading off <===
SQL> Spool /oradata/backup/spooltext.txt
SQL> Query(sql query)
SQL> Spool off
We create a file in D:\External_Tables named emp_query.sql with the following saved query.
SELECT EMPNO ||',' || ENAME || ',' || SAL || ',' || COMM FROM EMP; SQL> CONN manjit/manjit@pro Connected.
SQL> SET FEEDBACK OFF HEADING OFF ECHO OFF SQL> SPOOL D:\External_Tables\emp.csv SQL> @D:\External_Tables\emp_query.sql SQL> SPOOL OFF
To view the content of the file from SQLPLUS, type..
SQL> host type D:\External_Tables\emp.csv
No comments:
Post a Comment