Subject Res: [firebird-support] INSERT Multiple Rows same SQL Statment
Author Luis Carlos Junges
>I can see where using a single statement will reduce 'time' in any way.
For me will reduce the time because my problem is with the time spent to execute the SQL statement through ODBC driver. Now i have to execute several statement instead of one. If i execute just one, i hope to reduce drastically the time.


>insert into table_ (field1, field2)
>select val1_1, val2_1 from rdb$database union all
>...
>select val1_2, val2_2 from rdb$database;

This just work if i have a populated table. Not my case. I am trying to insert new values.



>execute block as (
>insert on _table_ (field1,field2, field3,field4) values ('USD', 'EUR',
>2008,0.93);
>insert on _table_ (field1,field2, field3,field4) values ('BLR', 'AUD',
>2007,x.xx);
> ...
>)

I think it will work.. i have to read the right sintax.


---
Luís Carlos Dill Junges ©

"A realidade de cada lugar e de cada época é uma alucinação coletiva."
Bloom, Howard







----- Mensagem original ----
De: Anderson Farias <peixedragao@...>
Para: firebird-support@yahoogroups.com
Enviadas: Quarta-feira, 24 de Setembro de 2008 11:10:34
Assunto: Re: [firebird-support] INSERT Multiple Rows same SQL Statment


Hi,

>Unfortunatelly it did not work in firebird. Do we have a way to insert
>multiple rows in a single
>statment in firebird?

You have to use multiple insert statments. You may, if desited, use EXECUTE
BLOCK to 'goup' those statements.

>I want to reduce time by inserting everything i need in a single statment.

I can see where using a single statement will reduce 'time' in any way.

> I wanna insert several currency quotes in tbcurrencyquotes in the
> following format:
>USD EUR 2008 0.93
>BRL AUD 2007 x.xxx

something like

execute block as (
insert on _table_ (field1,field2, field3,field4) values ('USD', 'EUR',
2008,0.93);
insert on _table_ (field1,field2, field3,field4) values ('BLR', 'AUD',
2007,x.xx);
...
)^

(this is not the correct syntax, look at the release notes)

Note that "old" FB versions do not suport execute block.

Regards,
Anderson Farias




Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @... ou @rocketmail..com.
http://br.new.mail.yahoo.com/addresses

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