Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread if exists
Mon, Nov 12 2007 5:26 AMPermanent Link

"Harry de Boer"
Tim,

I used in dbIsam scripts like:

DROP TABLE IF EXISTS memory tmpJTOV;
SELECT extract(month from Datum) AS maand, SUM(Bedrag) AS bedr
INTO memory tmpJTOV

so that there was no error executing the script the second time (when tmpJOV
was created). What's the proper way to do this in EDB 1.06?

Regards, Harry

Mon, Nov 12 2007 6:10 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Harry,

<< I used in dbIsam scripts like:

DROP TABLE IF EXISTS memory tmpJTOV;
SELECT extract(month from Datum) AS maand, SUM(Bedrag) AS bedr
INTO memory tmpJTOV

so that there was no error executing the script the second time (when
tmpJOV was created). What's the proper way to do this in EDB 1.06? >>

You should probably use a temporary table intead because it avoids a lot of
database switching:

SCRIPT
BEGIN
  DECLARE TempCursor CURSOR FOR stmt;

  PREPARE stmt FROM 'SELECT * FROM Information.Tables WHERE Name = ?';

  OPEN TempCursor USING 'TmpJTOV';

  IF (ROWCOUNT(TempCursor) > 0) THEN
     EXECUTE IMMEDIATE 'DROP TABLE tmpJTOV';
  END IF;

  CLOSE TempCursor;

  EXECUTE IMMEDIATE 'CREATE TEMPORARY TABLE tmpJTOV AS
                    SELECT extract(month from Datum) AS maand, SUM(Bedrag)
AS bedr
                    FROM MyTable WITH DATA';

END


Image