Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

To repeat a query

Vincenzo Restuccia
Honored Contributor

To repeat a query

I want to repeat this query 295 times and I have the name "variable" in a file or in a db table. I want a PL/SQL script.


select * from nas where name='variable'


Thanks
2 REPLIES
Sridhar Bhaskarla
Honored Contributor

Re: To repeat a query

Hi,

A DBA may answer your question better.

Meanwhile, this is what I did for my cgi's.

sql_file contents


...
select * from table where name="REPLACE_THIS"
..

Following is the CGI

...
VAR=$1 #an example of assigning a variable
sed 's/REPLACE_THIS/,/'$VAR'/' sql_file > /tmp/sql$$

/tmp/sql$$ #run the sql script

rm /tmp/sql$$

...

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
harry d brown jr
Honored Contributor

Re: To repeat a query

Have you thought about using perl?

http://tlowery.hypermart.net/perl_dbi_dbd_faq.html

http://www.saturn5.com/~jwb/dbi-examples.html

and a library of perl docs :

http://www.palslib.com/Perl_DBI/Readings.html


live free or die
harry
Live Free or Die