Pre-Insert Pre-Update triggers from a form [message #82177] |
Thu, 01 May 2003 14:04 |
Andy G
Messages: 25 Registered: May 2003
|
Junior Member |
|
|
Hi All,
Gald I found this forum hope you can help.
I'm a newbie to SQL and need to do soemthing fast and simple on my latest project.
I have a form that user's will be able to type in or correct product_names in a product table.....
What I need to do is put in sql code to validate that an already existing product name doesn't exist. I want to display a message alert if it can't update the prodcut name information for the record that will state that one already exists.....Can I get soem help with this?
So in a nutshell I need to validate any inserts or updates to the product name to make sure that there is no existing product of the same name and I have to message the user that he will have to choose another name.....
Thank you and I really appreciate any quick help you can provide ...
Andy
|
|
|
Re: Pre-Insert Pre-Update triggers from a form [message #82189 is a reply to message #82177] |
Sun, 04 May 2003 23:58 |
Cindreen Rameshwaran
Messages: 4 Registered: May 2003
|
Junior Member |
|
|
hi,
u can use the pre-insert and pre-update triggers of your respective data block.
type the following code after making the required changes.
declare
v_cnt number;
begin
select count(*) into v_cnt
from
.product_name;
if v_cnt > 0 then
message('Such a product already exists! So change the product name.');
go_item('<datablock-name>.product_name');
raise form_trigger_failure;
end if;
end;
hope this will solve your problem.
bye.
|
|
|