Re: output to terminal with SQL
Posted in 1998
Jonathan Leffler wrote:
>
> Albert Geisser wrote:
> > Is it possible to output any status information with SQL.
> > (something like a 'echo' on bourne shell)
> > If yes how?
>
> Well, it depends on what you're looking for... DB-Access emits
> comments like 'table created' anyway, reporting errors when it runs
> into them. But it continues regardless. You can also do things like
>
> dbaccess somedb - <<EOF
> !date
> update sometable set somecol = 37000 where someothercol < 1;> !date
> EOF
>
> This will run the Unix date command before and after the UPDATE
> statement. By extension, you can also run the Unix echo command too.
>
> If you want more control, consider SQLCMD from the IIUG archives,
> which I wrote so this is not an unbiassed recommendation. It has
> a built-in echo command; it also has *slightly* more sophisticated
> control over errors -- you can control whether the script continues
> or stops after an error (instead of having to continue). Not very
> much better, but somewhat better.
>
> --
>
> Yours,
> Jonathan Leffler (jleffler@informix.com aka jleffler@earthlink.net)
> #include <far-too-many-aliases.h>
> #include <guardian-of-DBD::Informix.h>
> #include <disclaimer.h>
Something I do at the top of scripts is this:
SELECT 'Any old text you like for a title of the report ' title,
today printed
from informix.systables where tabid = 1;
It seems to be the nearest to echo that works in all environments.
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
Mail: Peter.Lancashire.PL1@bayer.co.uk
---
My Internet plumbing does not allow me to mail and post news together.
Sorry.
All opinions are my own and not those of Bayer plc.
---
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/