Thanks Mike! Question.... If method 1 is considered a "good technique", is
there anything wrong with just turning the error messages off and creating the
table even when it already exists? Is there any reason to think that would
cause any problems like a memory leak or database corruption if that were done
many times? Could it slow down the application?
Mike
(\__/)
(='.'=)
(")_(")
On Jul 11, 2010, at 3:03 PM, "Mike Byerley" <[email protected]> wrote:
You can do it the following way:
{begin Code}
SET ERROR VAR verr
SET MESSAGE OFF
SET ERROR MESSAGES OFF
SET VAR vmsg TEXT = NULL
CREATE TEMP TABLE ttemp (dummy TEXT (8))
{first run as is then rem out the next line and unREM the one after to see diff}
SET VAR vtmptable = 'tTemp'
--SET VAR vtmptable = 'SomeTableName'
LIST &vtmptable
IF verr = 2038 THEN
SET VAR vmsg = ('Table' & (LUC(.vtmptable)) & 'doesn''t exist!')
PAUSE 2 USING .vmsg
ELSE
SET VAR vmsg = ('Table' & (LUC(.vtmptable)) & 'found!')
PAUSE 2 USING .vmsg
ENDIF
SET MESSAGE ON
SET ERROR MESSAGES ON
RETURN
{End Code}
or you can do
SET VAR vcount INTEGER = 0
SET VAR vtmptable = 'tTemp'
SELECT COUNT (*) INTO vcount IND vin0 FROM sys_tables WHERE sys_table_name =
.vtmptable
IF vcount = 0 THEN
SET VAR vmsg = ('Table' & (LUC(.vtmptable)) & 'doesn''t exist!')
PAUSE 2 USING .vmsg
ELSE
SET VAR vmsg = ('Table' & (LUC(.vtmptable)) & 'found!')
PAUSE 2 USING .vmsg
ENDIF
----- Original Message ----- From: "Michael J. Sinclair" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Sunday, July 11, 2010 2:16 PM
Subject: [RBASE-L] - How do I tell if a temporary table exists?
Hi All,
How can I tell if a temporary table exists? I know there is a function to find
out if a file exists, is there something similar for a temporary table?
Mike