Re: Command line isql or borne-again-sql (basql)
Posted in 1993
->From: Lester Knutsen <lester@access.digex.net>
->Subject: Re: Command line isql or borne-again-sql (basql)
->To: daemous@illuminati.io.com
->Date: Wed, 1 Dec 1993 00:07:47 -0500 (EST)
->>
->> I want to be able to issue an informix query from a script. I'm looking
->> for stdin-out (or using file.sql to generate an output file).
->>
->> I've got isql with my 4.10 Informix engine.
->>
->> --Daemous
->
->This is an Draft articule for the next WAIUG Newsletter on ways
->to use sql in shell scripts. I hope it might help here.
->
->Regards - Lester
->
...[stuff omitted]...
->
->Figure 1.
->#!/bin/sh
->dbaccess - - <<SQLSTMT
->database stores5;
->select customer_num, fname, lname, company from customer;
->SQLSTMT
->
...[more stuff omitted]...
->This is like typing
->dbaccess - - <filename where filename is a file with the SQL
->commands.
...[even more stuff omitted]...
Lester,
Thanks for the tutorial on here documents, which filled some gaps in my
understanding of such things. FWIW, I have found that the following
syntax also works:
isql dbname - <<EOF
select ....EOF
The main difference is placing the database name directly in the isql (or
dbaccess) command, eliminating the need to have a 'database dbname;'
statement in the following SQL.
When using SQL from a file, I use
isql dbname filename
instead of
isql - - <filename
The above comments apply to ISQL v 2.10.03F; I haven't verified that they
apply to other versions, but I expect they do.
Regards,
Alan ___________________________
______________________| R. Alan Popiel |__________________________
\\ Internet: | Martin Marietta, SLS | /
\\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. /
)Voice: | Denver, CO 80201-0179 USA | (
/ 303-977-9998 |___________________________| (But you knew that!) \\
/________________________) (____________________________\\