Hi to all,

I have a endday.sh file. And I execute this like "sh endday.sh" from command prompt. In endday.sh file it writes:

sqlplus temp/temp@data @run.sql&
echo $!>>pid.txt

However my aim is not to put the pid into pid.txt but I need to insert the pid into an oracle table using sqlplus.

so I change the endday.sh like this below:

sqlplus temp/temp@data @run.sql& (1)
sqlplus -s temp/temp@data << EOF (2)
insert into liv_pid (pid) values ($!);

In the insert into statement by using $!, do I take pid of 1 or 2, and indeed can I take the pid? And does this final endday.sh work?

Thank you very much, and I need urgent help....