Subject Re: [ib-support] Temporary table
Author Helen Borrie
At 10:49 AM 23-03-01 +0700, you wrote:
>Hi, All
>I am working with Interbase for many application (especially Web Applicaton),and
>The Performance is good.
>I want to ask about the Temporary Table, How to declare ???, and can Temporary table inserted using coomand Inset into .... values .......
>Because I've to use to use Temporary table in My application
>

<Moderator Hat On>

PLEASE DON'T POST TO THESE LISTS IN HTML !!!

</Moderator Hat Off>

Creating temporary tables is rarely necessary with InterBase (unlike e.g. MSSQL, which has no other means to generate a multi-row result set from a stored proc.) It's also a bad idea in a transactional RDBMS to have users creating and destroying objects.

Instead of creating a temporary table, create a table called "temp" of the structure you want and add a column to store some unique identifier for a specific user and connection (e.g. a "SessionID"). Create and insert rows as required, "session-stamping" each one with this SessionID. After committing, access the newly created rows in a new transactions with a query such as "SELECT <Fieldlist> from Temp where SessionID = ?SessionID". Perform housekeeping when the session terminates, with "DELETE FROM Temp WHERE SessionID = ?SessionID".

If you don't need to bring the temporary data to the user interface, don't have a Temp table at all. In InterBase, you can perform table updates that read data from one or more tables in one or more other tables using a stored procedure, without creating an intermediate on-disk structure at all, using the FOR SELECT...INTO...DO construct.

Cheers,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________