Subject Re: [firebird-support] temporal table for stored procedure
Author Alejandro Garcia
Sorry for the simple questions... I'm absolutelly new to SQL and relational databases and have thousands of queries to do.. I'll explain what I need:

I have a table with 80 columns, I need to select 3 of them: CLIENTID, DATE1 and DATE2 and order them by CLIENTID, DATE1 and DATE2 and then create another column that is a sequencial number (a generator) and after that create a table with that columns in that order.
So from the 80 columns table I need to create a table with 4 columns: the key which is the generator, the CLIENTID, DATE1 and DATE2 and I need to give that table a name to work with it in a procedure, this is the temporal table I need.

I know how to create a table from a select query, then I can order it and then create the generator after it is ordered, is this the way to do it?

Helen Borrie <helebor@...> escribió:
At 12:02 AM 7/04/2007, you wrote:
>Hi! Is it possible in IB 7.5 to work in a stored procedure with a
>temporal table created using a SELECT? I need something like this:
>SELECT Col1, Col2, Col3 FROM TABLE1 Where Contition1 AND Condtion2
>AND ConditionN
>ORDER BY Col1, Col3
>In the procedure I need the table to be in that order and I can't
>work with the original table TABLE1 because I need to preprocess it.

In relational databases you work with sets, not tables. In
procedural language modules (stored procedures and triggers) you
define your set in a cursor and loop through that. There are two
ways to do it in InterBase: using a FOR SELECT .... INTO <set of
variables> DO or (not documented by Borland) in a named cursor (which
is faster, if you are updating the underlying table).

If you want your "temporal table" to be returned to the client
application as a dataset, you can do that too. So be clearer about
what you want to do with this so-called "temporal table". If that is
what you want, look up the IB documentation index for "selectable
stored procedures".



LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.

[Non-text portions of this message have been removed]