vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi to all Ng Sorry for my bad english. I have got a problem. I understand if a user try to update more than 10 row in a table. So I think to create a trigger that by a row_count I 'll able to trap this event. for example CREATE TRIGGER TEST AFTER UPDATE ON TRK_RDA REFERENCING OLD AS old NEW AS new FOR EACH ROW MODE DB2SQL begin atomic declare rcount integer; get diagnostics rcount = row_count; if ( rcount > 1 ) then signal sqlstate '90920' (' Aggiornato piu di un record '); end if; end; I Think that's a good idea but does not work. Someone can show me where I'm foul Best thanks in advance Sergio Pipitone |
| |||
| eap90210 wrote: > Hi to all Ng > > Sorry for my bad english. > > I have got a problem. I understand if a user try to update more than 10 > row in a table. > > So I think to create a trigger that by a row_count I 'll able to trap > this event. for example > > CREATE TRIGGER TEST > AFTER > UPDATE > ON TRK_RDA > REFERENCING > OLD AS old NEW AS new > FOR EACH ROW > MODE DB2SQL > begin atomic > declare rcount integer; > get diagnostics rcount = row_count; > if ( rcount > 1 ) then > signal sqlstate '90920' (' Aggiornato piu di un record '); > end if; > end; > > I Think that's a good idea but does not work. Someone can show me where > I'm foul > > Best thanks in advance > > Sergio Pipitone > Sergio, Try this: CREATE TRIGGER TEST AFTER UPDATE ON TRK_RDA REFERENCING NEW_TABLE AS new FOR EACH STATEMENT MODE DB2SQL WHEN ((SELECT COUNT(1) FROM new) > 10) signal sqlstate '90920' (' Aggiornato piu di un record '); Cheers Serge -- Serge Rielau DB2 SQL Compiler Development IBM Toronto Lab |
| ||||
| thanks now the trigger working !! best thank again cheers Sergio Pipitone "Serge Rielau" <srielau@ca.ibm.com> ha scritto nel messaggio news:3qkh5vFfbfk2U2@individual.net... > eap90210 wrote: >> Hi to all Ng >> Sorry for my bad english. >> I have got a problem. I understand if a user try to update more than 10 >> row in a table. >> So I think to create a trigger that by a row_count I 'll able to trap >> this event. for example >> >> CREATE TRIGGER TEST >> AFTER >> UPDATE >> ON TRK_RDA >> REFERENCING >> OLD AS old NEW AS new >> FOR EACH ROW >> MODE DB2SQL >> begin atomic >> declare rcount integer; >> get diagnostics rcount = row_count; >> if ( rcount > 1 ) then >> signal sqlstate '90920' (' Aggiornato piu di un record '); >> end if; >> end; >> >> I Think that's a good idea but does not work. Someone can show me where >> I'm foul >> >> Best thanks in advance >> >> Sergio Pipitone >> > Sergio, > > Try this: > > CREATE TRIGGER TEST > AFTER > UPDATE > ON TRK_RDA > REFERENCING > NEW_TABLE AS new > FOR EACH STATEMENT > MODE DB2SQL > WHEN ((SELECT COUNT(1) FROM new) > 10) > signal sqlstate '90920' (' Aggiornato piu di un record '); > > Cheers > Serge > > -- > Serge Rielau > DB2 SQL Compiler Development > IBM Toronto Lab |