Shell Script to generate Dynamic Param file Using SQL Plus Quey

Hi All,

Can anyone give me Shell script sample script to generate Param file by Reading Values from SQL Plus query and it should assign those values to variables like..

$$SChema_Name='ORCL'

Thanks in Advance... Srav...

Please supply us with a small sample sql statement; SQL output and your desired result.
That is, you question does not give us enough information to allow us to give you any kind of decent answer.

Hi Jim,

I need to generate param file Dynamically using Linux shell script.

ex: i have query like...

   SQL> Select * from EMP;

 o/p Emp_No EMP_Name Location
         1         AAA          Tirupati
         2         BBB           Bangalore

...and my expected output is...

Param_Sample1.prm
------------------
$$EMP_No=1
$$EMP_NAME='AAA'
$$EMP_Location=Tirupati
/* These three values should go to one file  and second record details should go to second param file like....*/

Param_Sample1.prm
------------------
$$EMP_No=2
$$EMP_NAME='BBB'
$$EMP_Location=Bangalore...

like this i am expecting... Please help me on this....Sravan

We have discussed this already in thread

  1. Spool the query to a CSV file
  2. Read the values, format and write to param file
SEQ=0
while IFS=, read no name loc
do
        SEQ=$( expr $SEQ + 1 )
        {
         echo "\$\$EMP_No=$no"
         echo "\$\$EMP_Name=$name"
         echo "\$\$EMP_Location=$loc"
        } > Param_Sample${SEQ}.prm
done < EMP.csv

Hi bipinajith,

Thank you so much, i am sorry i did not cheked it....Thank you...i iwll try with this approach.... :slight_smile:

--Sravan