Re: Table lookup function in isql?
Posted in 1992
Judy Miller writes:
> Question: Is there some kind of table lookup feature in isql
> (Informix SQL Query Language)?
>
> Problem: I have a list of keys to 4000 records which I need to delete from
> a table of 12000.
> I'm trying to avoid writing a program for this common function.
> (I do not have 4GL on this machine, but I do have ESQL/C.)
How about (from the command line in sh or csh)
sed 's/.*/delete from tab_1 where my_key = "&";/' | isql db_name
assuming that you've got one key per line in the file ?
A bit slow, but dead simple. Add "begin work; .... ;commit work;"
either side of the delete if you need to.
Or create a table to load the list of keys into, then
isql db_name <<HERE
delete from tab_1 where my_key in (select my_key from tab_2); HERE
> Another option is to unload the table and eliminated the records outside of
> Informix, delete all, and then reload the remaining two-thirds.
That's what our Ingres consultant told me to do with my Ingres
database - what really worries me is that he *might* have told
me the best thing to do ... :-) :-)
> Judy
Hope these help.
Cheers - Tony.
__________________________________________________________________________
Tony Heskett th@bnr.co.uk Voice: (+44) 279 429531 x 2637
BNR, London Road, Harlow, Essex, CM17 9NA Fax: (+44) 279 454187