Calling binary from Perl prog and passing arguments

V

vineet

Hi Experts,

I have sql interface which connects to oracle database. When I execute
sql, it connects to database and give prompt where user can type sql
statemets to be executed ... some thing like
$
$
$SQL;
SQL>
SQL>
SQL> select * from employee;
........<display the sql result>.......

I wanted to write wrapper script over SQL interface and read a file
having SQL statement and passed it to SQL interface.

Can you please guide me how to start writing this.
Thanks,
VS
 
J

Jürgen Exner

vineet said:
I have sql interface which connects to oracle database. When I execute
sql, it connects to database and give prompt where user can type sql
statemets to be executed ... some thing like
$
$
$SQL;
SQL>
SQL>
SQL> select * from employee;
.......<display the sql result>.......

I wanted to write wrapper script over SQL interface and read a file
having SQL statement and passed it to SQL interface.

If you want the Perl program to interact with the external program's STDIO
then one of the "Expect" modules from CPAN is probably the best approach.

If you just want to pass parameters to the external program then system() or
qx// will do that already.

However, maybe you should investigate if accessing the database directly
from your Perl program is the best solution. Again, there are several
modules for database access on CPAN.

jue
 
M

Mark Clements

vineet said:
Hi Experts,

I have sql interface which connects to oracle database. When I execute
sql, it connects to database and give prompt where user can type sql
statemets to be executed ... some thing like
$
$
$SQL;
SQL>
SQL>
SQL> select * from employee;
.......<display the sql result>.......

I wanted to write wrapper script over SQL interface and read a file
having SQL statement and passed it to SQL interface.

Can you please guide me how to start writing this.
Thanks,
VS
would

sqlplus < statement.sql

not do it, where statement.sql is the file containing the SQL statements?
 
V

vineet

Thanks group for your valuable time and advise.
I was looking some thing like expect
Vineet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top