Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Question: how to run SQL embedded in a Unix shell script. Replies gave the standard answer: pipe the statements into dbaccess using a here-document, e.g. `dbaccess <dbname> - <<EOT` ... SQL statements ... `EOT`, with the terminating marker at the start of the line and no trailing spaces; the database can also be selected with a `database stores7;` statement inside the here-doc. One poster also suggested wrapping single statements in single quotes passed to a helper command. Problem resolved.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Scott — — source: Informix-list mailing list archive (1991-1998)
how do I call up an SQL which is in a unix script?
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
↪ replying to Scott
Yang, Heung-Soon — — source: Informix-list mailing list archive (1991-1998)
Try this example...
#!/bin/ksh
dbaccess <<!
database stores7;
select * from customer;!
Wish this helps you...
Scott wrote:
> how do I call up an SQL which is in a unix script?
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!
↪ replying to Scott
kirt — — source: Informix-list mailing list archive (1991-1998)
Hey Scott
try starting the command with sqlstmt and enclosing it in single quotes.
I.E. sqlstmt 'delete from Table where column = VALUE'
or selectit 'select * from Table'
Scott <Scott_StephensonNOScSPAM@miwb.uscourts.gov.invalid> wrote in message
news:1a014600.fa002cf9@usw-ex0108-057.remarq.com...
> how do I call up an SQL which is in a unix script?
>
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!
>
dbaccess <dbname> - <<EOT!
select stuff from tables;EOT!
this works just make sure that the final EOT is at the beginning of the line
and there are no blank spaces at the end of the line.
----- Original Message -----
From: Scott <scott_stephensonnoscspam@miwb.uscourts.gov.invalid>
To: <comp.databases.informix@list.deja.com>
Sent: Wednesday, November 24, 1999 2:02 PM
Subject: SQL script in unix script
> Message from the Deja.com forum:
> comp.databases.informix
> Your subscription is set to individual email delivery
> >
> how do I call up an SQL which is in a unix script?
>
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!
>
>
>
>
> _____________________________________________________________
> Deja.com: Before you buy.
> http://www.deja.com/
> * To modify or remove your subscription, go to
> http://www.deja.com/edit_sub.xp?group=comp.databases.informix
> * Read this thread at
>
http://www.deja.com/thread/%3C1a014600.fa002cf9%40usw-ex0108-057.remarq.com%
3E
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.