RE: How to drop a temp table using "if exists" logic ?
Posted in 2006
Unfortunately, I believe this will find a temporary table by the
specified name in any session on the instance, not just the current one.
Also, as a note, it may return greater than one if the table is
fragmented.
We have also run into this, and would dearly love to see a simple way to
get a list of a session's temp tables.
DC
> -----Original Message-----
> From: informix-list-bounces@iiug.org [mailto:informix-list-
> bounces@iiug.org] On Behalf Of Tambi Dude
> Sent: Monday, December 11, 2006 4:01 AM
> To: informix-list@iiug.org
> Subject: Re: How to drop a temp table using "if exists" logic ?
>
>
> "Veeru71" <m_adavi@hotmail.com> wrote in message
> news:1165830720.623257.143700@j72g2000cwa.googlegroups.com...
> > Thanks Bozon for articulating so clearly the need for the existence
of
> > temp tables.
> > Somehow I feel that it is always much cleaner to check for existence
> > and drop it if exists
> > EXPLICITY, rather than firing the 'drop table' command and ignoring
> > the warning.
> > I could not find a solution though :)
> > - Murty
> >
>
> This is the query to find out whether temp table already exists
> in your session.
> SELECT count(*)
> into w_count
> from sysmaster:systabnames s,sysmaster:systabinfo i
> where i.ti_partnum = s.partnum
> and sysmaster:BITVAL(i.ti_flags,'0x0020') = 1
> and s.tabname = 'your_tmp_table_name' ;>
>
> The query will return 1 if the temp table exists.
>
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list