문제

SELECT column1
FROM (SELECT column1 FROM SCHEMA_B.ABC);

The above is a sample of my spool script attempting to spool data into a flat file from a different database. What are the steps to make it happen? Do I need permission/access to that database? How does it work? I am fairly new to this, so a thorough explanation will be appreciated.

Thanks in advance.

도움이 되었습니까?

해결책

SQL loader is a tool to load data into a database, not to get data out.

You can change the query to get data in the exact format you want and then use SPOOL, which is a SQLPLUS command to print data to a file. Something like this.

sqlplus <connection_details>

spool "C:/Documents/Downloads/data_out.txt"

select empname || ',' || ename
from emp
where dept = 10

spool off;

The data from the query would be spooled to the text file.

Another option, if you are using a tool like SQL Developer or Toad is click on the data grid in the results tab and "export". There are a bunch of options to export data in various formats.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top