Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread TEMPORARY table causes a.v. on server
Wed, Apr 1 2009 6:19 AMPermanent Link

Tiago Ameller
This script has two issues:

/*
 Export today's server log to csv
*/               
SCRIPT ()
BEGIN
 EXECUTE IMMEDIATE
' CREATE TEMPORARY TABLE TODAYS_LOG AS
 SELECT
 "LOGTIMESTAMP",
 "USER",
 "CATEGORY",
 "FUNCTION",
 "DESCRIPTION"
 FROM
 CONFIGURATION.LOGEVENTS
 WHERE
 LOGTIMESTAMP BETWEEN CURRENT_DATE AND CURRENT_DATE + INTERVAL "1" DAY
 WITH DATA';
 
 EXECUTE IMMEDIATE
   'EXPORT TEMPORARY TABLE TODAYS_LOG TO "TODAYS_LOG.CSV"
   IN STORE CLIENTS
   DELIMITER CHAR '';''
   DATE FORMAT ''DD/MM/YYYY''
   TIME FORMAT ''HH:MM:SS''
   DECIMAL CHAR '',''
   INCLUDE HEADERS';
END

1. Server raises: ElevateDB Error #900 An error occurred with the statement at line 7 and column 1 (Access violation at address 00000000. Write
of address 00000000)

2. How to reach created TEMPORARY TABLE? EXPORT TEMPORARY TABLE TODAYS_LOG TO ... is not correct

3. How to delete it when script terminates?

In 18/dec/2008 Tim wrote "2.03 is going to finally have a catalog table for temporary tables, and then I can see about adding them as a separate
list in the EDB Manager."

Some times I need an middle table in a two pass process as described. Temporary tables are a good solution due no in_memory database is
needed.
Thu, Apr 2 2009 6:33 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Tiago,

I couldn't reproduce the AV and since build 11 is arriving, maybe this is
already fixed or if not, let's wait to see if Tim can confirm this.
I can however answer the other questions:

> 2. How to reach created TEMPORARY TABLE? EXPORT TEMPORARY TABLE TODAYS_LOG
> TO ... is not correct

It's simply EXPORT TABLE , just like any other table.
Appart from the fact that temporary tables are only visible to the current
session and some restrictions on DDL statement that can be used, after
created a temporary table is treated exacly the same way as if it was not
temporary.

> 3. How to delete it when script terminates?

DROP TABLE TODAYS_LOG
You can drop it from the script, just after exporting.

--
Fernando Dias
[Team Elevate]

Thu, Apr 2 2009 3:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Tiago,

<< 1. Server raises: ElevateDB Error #900 An error occurred with the
statement at line 7 and column 1 (Access violation at address 00000000.
Write of address 00000000) >>

That happens when you try to create a temporary table when the active
database is the Configuration database.  If you select a valid user-defined
database, it will work okay.  A fix will be in B11 so that a proper error
message is raised that prevents you from trying to create a temporary table
in the Configuration database.

<< 2. How to reach created TEMPORARY TABLE? EXPORT TEMPORARY TABLE
TODAYS_LOG TO ... is not correct >>

Just use EXPORT TABLE - leave off the TEMPORARY.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image