run sql queries from UNIX shell script.

How can i run sql queries from UNIX shell script and retrieve data into text docs of UNIX? :confused:

output from emp table will be copied onto /tmp/output.txt with the below

sqlplus -s username/password@dbname <<! > /tmp/output.txt
SET FEED OFF;
SET PAGES 0;
select * from emp;
EXIT;
!
1 Like