[Info-Ingres] Running Ingres SQL commands from a shell script ?

"Wiśniewski, Piotr, (ProService AT)" Piotr.Wisniewski at psat.pl
Thu Apr 26 05:49:28 CDT 2007


BTW,
I'd like to know when does the SQL command return nonzero exit status.
Recently I upgraded to Ingres 2006 Version II 9.0.4 (a64.sol/105)
and I noticed that sometimes the exit status is set to nonzero when certain 
SQL errors occur when running the sql script. I recall in previous versions
such errors did not cause nonzero exit status. The exit status was always 0
unless some invocation error occurred like when running
sql db < non_existing_file


-----Original Message-----
From: Dan Stromberg [mailto:dstromberg at datallegro.com] 
Sent: Thursday, April 26, 2007 3:33 AM
To: info-ingres at kettleriverconsulting.com
Subject: [Info-Ingres] Running Ingres SQL commands from a shell script?


Hi folks.

Is there any good way, from a shell script, to run SQL commands against
Ingres (perhaps via ingres' terminal monitor), and to get a useful exit
status from the SQL statements back to the calling shell?

I realize I could use something like python with an ODBC interface, but 1)
that seems kind of heavyweight for what I want to do and 2) I don't think
I'll be able to get permission to put an ODBC interface -on- the
machines in question.  It's pretty much whatever comes with CentOS 4.4 or
not at all for this project.

Ideal might be to have any exit stati and'd or or'd together (dare I say,
at the caller's discretion?), or to have an array of exit stati kind of
like bash's $PIPESTATUS array, except for a chronology of statements, not
concurrent-but-chained-together statements.

If I must, I could run the SQL statements (the ones with side effects,
at least) one a time though.

Any suggestions?

Thanks!

_______________________________________________
Info-Ingres mailing list
Info-Ingres at kettleriverconsulting.com
http://www.kettleriverconsulting.com/mailman/listinfo/info-ingres


More information about the Info-Ingres mailing list