Re: SQL queries from shell scripts, and capitalisation
Posted in 1997
phil@oyster.co.uk wrote:
>
> I have 2 questions:
>
> (1) How do I run an SQL query from the Unix shell? In the
> FAQ it talks about running isql, but this doesn't seem to
> be on my system. Is isql part of OnLine or does it only
> come with the other Informix database?
Isql was replaced with dbaccess when the forms and reports were
unbundled in R4.01. Just do this:
dbaccess mydatabase - <myscript.sql
-OR-
dbaccess mydatabase myscript.sql
The latter will stop on the first error while the former will continue.
>
> (2) I have a table which includes a row of strings which
> are in all upper case. I want to output the result in mixed
> case with the 1st character of every word capitalised, and
> the other characters in lower case. Is it possible to do
> this in SQL? I have heard of user-defined functions, but
>
There is a stored procedure to upshift a string, a version could
be written to do what you want. Check the IIUS archives. However,
the stored procedure is SLOW! You will be better in shell, perl, or
awk.
Art S. Kagel