Re: if EXISTS in ksh script
Posted in 1998
Andreas Bettin — — source: Informix-list mailing list archive (1991-1998)
Try the following:
#!/bin/ksh
table="anytable"
database="mydatabase"
~informix/bin/dbaccess $database -<<@ 1>/tmp/$$.out 2>&1
select tabname from systables
where tabname = "$table";@
if grep -i -q "No rows found." /tmp/$$.out
then
echo "Table not found"
else
echo "Table found"
fi
rm /tmp/$$.out
# Ends
This is not very fast, but it works fine.
Bye
Andy M. Bettin
Don Boling schrieb in Nachricht ...
>I am trying to test if a table exists in a korn shell script
>before I execute "create table (...) "
>
>I have not found any reference in Informix SQL manuals on how to do this...
>
>any suggestions would be greatly appreciated....
>
>Don
>dboling@vnet.net
>
>