Subject AW: AW: AW: [firebird-support] not EM goal, but question about firebird statement
Author Olaf Kluge
I create a stored procedure with autonomous transaction, it works fine!
> But if I call these stored procedure in a table-trigger, it works not. The
> trigger probably uses only one transaction. But the trigger isn't the
right
> place for the stored procedure-code.
>
> Is there a possibility to use the (*) by inserting data? (insert into
> table(*) select * from tableb. The second select all is possible, but for
> the insert need to write down all table columns. And there are many
> columns.

-If the table structure matches, which is the case in your scenario I
-think, you can simply do a:

-insert into desttable select * from srctable;

-Of course, you can also expand your source field list by adding
-constants, e.g.:

-insert into desttable select s.*, 1, 'a' from srctable;

-if your destination table has additional columns.

-Regards,
-Thomas

Hello,



I have check this before but it don't work:



stmtxt = 'insert into B_' || :str_j ||'

select LNR, TS from t_dt where lnr <' || :toid ||' and substring(ts from 1
for 4) = ' || :str_j ||';';

execute statement :stmtxt;



I have spit the functions in my trigger and split the transactions, but it
works not. Only if I paste the code into a stored procedure and call it
direct.:



AS

declare variable i integer;

declare variable str_j char(4);

declare variable chkproz integer;

begin

i=GEN_ID(MOVE_T_DT_GEN, 1);

if (i>16000) then

Begin

i=GEN_ID(MOVE_T_DT_GEN, -1000);

i=new.lnr - 15000;

for select substring(ts from 1 for 4) as tsz from t_dt where lnr < :i

group by tsz into :str_j

do

begin

if(str_j is not null) then

begin

if (not exists(select 1 from rdb$relations where rdb$relation_name =

'B_' || :str_j)) then

begin

in autonomous transaction do

begin

select proz_status from p_db_add_new_btable(:str_j) into
:chkproz;

end

end

in autonomous transaction do

begin

execute procedure p_db_move_records(:i,:str_j);

end

end

end

end

end



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