Re: Run command on sqlplus repetitively without reconnection.

  • From: "Jared Still" <jkstill@xxxxxxxxx>
  • To: cichomitiko@xxxxxxxxx
  • Date: Wed, 9 May 2007 17:39:35 -0700

On 5/9/07, Radoulov, Dimitre <cichomitiko@xxxxxxxxx> wrote:

 } I want to run a command on sqlplus without making re-connection. At the
} same time I also want to see the output.

With ksh93 (and pdksh, on Linux for example) you can use co-processes:


I once wrote a set of shell scripts to do SQL commands from the
shell command line using co-processes.

There are some rather tricky bits to using sqlplus in a co-process,
and I don't think it was really worth the trouble, given the simplicity
of using sqlplus in the regular manner.

Once a job exceeds 50 or so lines of shell script, and/or requires
some convoluted scripting, I just use perl.  Much simpler and cleaner.

And if it is a job is all done in a single database, I just use PL/SQL or
SQL.

Anything requiring simultaneous multiple db connections is also done in
Perl,
as you can't do it easily with shell and sqlplus.

Sorry Neil O. if perl makes your head hurt.  I guess you will just
have to continue doing things the hard way. :)


--
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: