Subject | how manage an insert without constraint error |
---|---|
Author | ndirondello marco |
Post date | 2012-03-16T13:56:11Z |
hi all, i'm using fb 2.5
i need to insert rows that often violate an unique constaint on 3 columns.
i would like to manage the violation on the db using a procedure that will insert a single row and that will return 1 if the record has been correctly inserted or 0 if there was same errors.
the records count of the table is in the order of the milions.
i want know if is faster to
- check if same record with the same cosntraint values exists and if it doesnt exist then do the insert
or
- try to insert and catch the potential constraint violation excpetion
i would also ask for the exact syntax to catch a cosntraint violation exception without rethrowing it
thanks
i need to insert rows that often violate an unique constaint on 3 columns.
i would like to manage the violation on the db using a procedure that will insert a single row and that will return 1 if the record has been correctly inserted or 0 if there was same errors.
the records count of the table is in the order of the milions.
i want know if is faster to
- check if same record with the same cosntraint values exists and if it doesnt exist then do the insert
or
- try to insert and catch the potential constraint violation excpetion
i would also ask for the exact syntax to catch a cosntraint violation exception without rethrowing it
thanks