Stored Procedure Error !
Posted in 1999
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
Hi all, I have a stored procedure which is invoked from a Trigger on a insert statement in a table. Now, My SP inserts data into 2 tables, whish are mirror of each other. What happens here is that if it finds the data in any table it gives primary key violation error and comes out. What i want is that if there is no data then insert else dont but dont give any error and abort. I tried Raise Exception (0) (ZERO) ...doesnt work.. Now i m doing it this way that first i query on table to see if the record is there or not and then insert Is there any other way to achive in SP only ? TIA, Nayan Jain - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Life is a song, sing it. "
Nayan Jain wrote: > > Hi all, > > I have a stored procedure which is invoked from a Trigger on a insert > statement in a table. > > Now, My SP inserts data into 2 tables, whish are mirror of each other. > What happens here is that if it finds the data in any table it gives > primary key violation error and comes out. What i want is that if there is > no data then insert else dont but dont give any error and abort. > > I tried Raise Exception (0) (ZERO) ...doesnt work.. > > Now i m doing it this way that first i query on table to see if the record > is there or not and then insert > > Is there any other way to achive in SP only ? Just trap the exception and then ignore it, don't raise anything. Art S. Kagel