Calling binary from Perl prog and passing arguments

Discussion in 'Perl Misc' started by vineet, Jan 17, 2008.

  1. vineet

    vineet Guest

    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
    vineet, Jan 17, 2008
    #1
    1. Advertising

  2. vineet <> wrote:
    >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
    >
    >Can you please guide me how to start writing this.
    >Thanks,
    >VS
    Jürgen Exner, Jan 17, 2008
    #2
    1. Advertising

  3. vineet wrote:
    > 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?
    Mark Clements, Jan 17, 2008
    #3
  4. vineet

    vineet Guest

    Thanks group for your valuable time and advise.
    I was looking some thing like expect
    Vineet
    vineet, Feb 1, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. -intl.com
    Replies:
    1
    Views:
    349
    Martin Gregorie
    Oct 22, 2006
  2. Navaneeth
    Replies:
    4
    Views:
    536
    Kenny McCormack
    Nov 20, 2010
  3. Replies:
    6
    Views:
    221
    Peter Makholm
    Feb 10, 2010
  4. oldyork90
    Replies:
    10
    Views:
    327
    Jorge
    Sep 27, 2008
  5. Yogi
    Replies:
    1
    Views:
    414
    Peter Makholm
    Sep 13, 2012
Loading...

Share This Page