![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
I have tried the following & it is not working: ALTER TRIGGER "HoldingTrig".HoldingTrig after insert order 4 on DBA.TBLRECORD referencing new as new_name for each statement begin declare @idd integer; declare @idf integer; declare @el1el integer; declare @ids integer; declare @err_notfound exception for sqlstate value '02000'; //declare a cursor for table new_name declare new1 dynamic scroll cursor for select ID_drd,id_fc,elog1_el,id_dss from new_name; open new1; //Open the cursor, and get the value LoopGetRow: loop fetch next new1 into @iddrd, @idfc,@elog1el,@iddss; insert into tblholding_th( ID_drd,id_fc,elog1_el,id_dss) values ( @idd,@idf,@el1el,@ids) ; if sqlstate = @err_notfound then leave LoopGetRow end if end loop LoopGetRow; close new1 end |
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
|
I have tried the following & it is not working: ALTER TRIGGER "HoldingTrig".HoldingTrig after insert order 4 on DBA.TBLRECORD referencing new as new_name for each statement begin declare @idd integer; declare @idf integer; declare @el1el integer; declare @ids integer; declare @err_notfound exception for sqlstate value '02000'; //declare a cursor for table new_name declare new1 dynamic scroll cursor for select ID_drd,id_fc,elog1_el,id_dss from new_name; open new1; //Open the cursor, and get the value LoopGetRow: loop fetch next new1 into @iddrd, @idfc,@elog1el,@iddss; insert into tblholding_th( ID_drd,id_fc,elog1_el,id_dss) values ( @idd,@idf,@el1el,@ids) ; if sqlstate = @err_notfound then leave LoopGetRow end if end loop LoopGetRow; close new1 end |
#7
| |||
| |||
|
|
fetch next new1 into @iddrd, @idfc,@elog1el,@iddss; |
|
insert into tblholding_th( ID_drd,id_fc,elog1_el,id_dss) values ( @idd,@idf,@el1el,@ids) ; |
|
I have tried the following & it is not working: ALTER TRIGGER "HoldingTrig".HoldingTrig after insert order 4 on DBA.TBLRECORD referencing new as new_name for each statement begin declare @idd integer; declare @idf integer; declare @el1el integer; declare @ids integer; declare @err_notfound exception for sqlstate value '02000'; //declare a cursor for table new_name declare new1 dynamic scroll cursor for select ID_drd,id_fc,elog1_el,id_dss from new_name; open new1; //Open the cursor, and get the value LoopGetRow: loop fetch next new1 into @iddrd, @idfc,@elog1el,@iddss; insert into tblholding_th( ID_drd,id_fc,elog1_el,id_dss) values ( @idd,@idf,@el1el,@ids) ; if sqlstate = @err_notfound then leave LoopGetRow end if end loop LoopGetRow; close new1 end |
#8
| |||
| |||
|
|
You are fetching into a different set of variables... * *fetch next new1 into @iddrd, * * *@idfc,@elog1el,@iddss; ...than your are using in your INSERT VALUES list... * *insert into tblholding_th( ID_drd,id_fc,elog1_el,id_dss) values ( @idd,@idf,@el1el,@ids) ; AFAIK the column values will all be NULL. Breck On Tue, 15 Sep 2009 04:12:35 -0700 (PDT), Zoe laurakeave... (AT) gmail (DOT) com> wrote: I have tried the following & it is not working: ALTER TRIGGER "HoldingTrig".HoldingTrig after insert order 4 on DBA.TBLRECORD referencing new as new_name for each statement begin *declare @idd integer; *declare @idf integer; *declare @el1el integer; *declare @ids integer; *declare @err_notfound exception for sqlstate value '02000'; *//declare a cursor for table new_name *declare new1 dynamic scroll cursor for select ID_drd,id_fc,elog1_el,id_dss from * * *new_name; *open new1; *//Open the cursor, and get the value *LoopGetRow: loop * *fetch next new1 into @iddrd, * * *@idfc,@elog1el,@iddss; * *insert into tblholding_th( ID_drd,id_fc,elog1_el,id_dss) values ( @idd,@idf,@el1el,@ids) ; * *if sqlstate = @err_notfound then * * *leave LoopGetRow * *end if *end loop LoopGetRow; *close new1 end -- Breck Carterhttp://sqlanywhere.blogspot.com/ RisingRoad SQL Anywhere and MobiLink Professional Services breck.car... (AT) risingroad (DOT) com- Hide quoted text - - Show quoted text - |
#9
| |||
| |||
|
|
I have tried the following & it is not working: ALTER TRIGGER "HoldingTrig".HoldingryTrig after insert order 4 on DBA.TBLRECORD referencing new as new_name for each statement begin declare @idd integer; declare @idf integer; declare @el1el integer; declare @ids integer; declare @err_notfound exception for sqlstate value '02000'; //declare a cursor for table new_name declare new1 dynamic scroll cursor for select ID_drd,id_fc,elog1_el,id_dss from new_name; open new1; //Open the cursor, and get the value LoopGetRow: loop fetch next new1 into @iddrd, @idfc,@elog1el,@iddss; insert into tblholding_th( ID_drd,id_fc,elog1_el,id_dss) values ( @idd,@idf,@el1el,@ids) ; if sqlstate = @err_notfound then leave LoopGetRow end if end loop LoopGetRow; close new1 end |
![]() |
| Thread Tools | |
| Display Modes | |
| |