I came to a situation where I need to write flat files using shell scripts, I need to pull the records from the oracle database and create the flat file, This process should be automated.
Can any shell script expert out here to help me.. please..
Howz bouts thiz
(1) Write a SQL script to spool data to a file
(2) Write UNIX script to invoke SQL script
Example:
(1)
/*
This is SQL script named: get_emp.sql
*/
spool ascii.txt
Select * from emp;
spool off
(2)
#!/bin/sh
#
# This is UNIX script named: cron.job
# Runs SQL script and e-mail result to users
#
sqlplus uid/pwd @get_emp.sql