Board index » delphi » Informix, Tquery, and multiple statements

Informix, Tquery, and multiple statements

How can I get multiple sql statements to execute using one Tquery.

query1.sql.add(
' select od_ordr_item,  od_qty '+
' from so_delivery  '+
' where od_stat = 1 '+
' into temp tmp_tbl; '+
' update tmp_tbl  '+
' set tmp_tbl.od_qty = tmp_tbl.od_qty + 1' );
query1.execsql;

This gives me an error (EDBEnginerror,  'Table tmp_tbl does not exist').

Is this error coming out of the prepare?

Just wondering if anyone found a way to make this work.

I can make it work by adding the statements separately at run time, and
execsql'ing twice.
Or by using 2 Tqueries.  ( for this app I have about 100 statements, so
100 Tqueries
is a bit much).
Is this the only way?
Having everything all wrapped up in one Tquery at design time would be
nice.

Thanks,
David Zepp
dz...@ssfab.com

 

Re:Informix, Tquery, and multiple statements


David,

take a look RxLib at http://rx.demo.ru.
This is a good freeware component collection with source.

It contains a component called TSQLScript, which exactly
does what you want.

Regards
Heinz Schiffmann

Quote
David Zepp wrote:

> How can I get multiple sql statements to execute using one Tquery.

> query1.sql.add(
> ' select od_ordr_item,  od_qty '+
> ' from so_delivery  '+
> ' where od_stat = 1 '+
> ' into temp tmp_tbl; '+
> ' update tmp_tbl  '+
> ' set tmp_tbl.od_qty = tmp_tbl.od_qty + 1' );
> query1.execsql;

> This gives me an error (EDBEnginerror,  'Table tmp_tbl does not exist').

> Is this error coming out of the prepare?

> Just wondering if anyone found a way to make this work.

> I can make it work by adding the statements separately at run time, and
> execsql'ing twice.
> Or by using 2 Tqueries.  ( for this app I have about 100 statements, so
> 100 Tqueries
> is a bit much).
> Is this the only way?
> Having everything all wrapped up in one Tquery at design time would be
> nice.

> Thanks,
> David Zepp
> dz...@ssfab.com

Other Threads