Hi,
I need suggestions in how to deal with the following scenario.
Currently I've got a user registration form (html) with the following fields:username, firstname, lastname and email address.
Usernames and email addresses are unique within the system and my database tables are checking for uniqueness. Up until now I have been running
two different queries prior to processing the insert statement in order to check if username and/or email address already exist in the database. Now I'm wondering if it's possible (or better) to remove
the need of running these two queries and instead let my pl/sql procedure throw an exception and deal with it that way. I added an exception block
to the userregistration procedure which is now catching a 'unique constraint' exception if duplicates are inserted.
Does this seem to be a better approach in how to handle duplicates? or is it better to do the checking of duplicates before I process the insert statement? I'm planning to implement the same structure to other parts of the system where I need to check for duplicate values.
Thanks
Erik
I need suggestions in how to deal with the following scenario.
Currently I've got a user registration form (html) with the following fields:username, firstname, lastname and email address.
Usernames and email addresses are unique within the system and my database tables are checking for uniqueness. Up until now I have been running
two different queries prior to processing the insert statement in order to check if username and/or email address already exist in the database. Now I'm wondering if it's possible (or better) to remove
the need of running these two queries and instead let my pl/sql procedure throw an exception and deal with it that way. I added an exception block
to the userregistration procedure which is now catching a 'unique constraint' exception if duplicates are inserted.
Does this seem to be a better approach in how to handle duplicates? or is it better to do the checking of duplicates before I process the insert statement? I'm planning to implement the same structure to other parts of the system where I need to check for duplicate values.
Thanks
Erik