Home » Developer & Programmer » Forms » Newbie!! how do I create a trigger in my forms
Newbie!! how do I create a trigger in my forms [message #232644] Sun, 22 April 2007 18:05 Go to next message
ladygunner
Messages: 1
Registered: April 2007
Junior Member
Greetings,
I am relatively new to forms and trying to learn as quickly as possible. But I have run into a roadblock trying to learn triggers.

I have a program, but when I run the program to create a WHEN_VALIDATE_ITEM trigger, I get a ERROR 201 - need to declare the identifier, which in this case is "products"

I am including the entire program as I have listed in my textbook
Any assistance in helping me to complete this, is greatly appreciated.
-Denice Cool

DECLARE
   NumberOfProducts     NUMBER

BEGIN
  SELECT count(*)
  INTO NumberOfProducts
  FROM products
  WHERE products.MemberID = :members.MemberID;

  IF NumberOfProducts = 0 THEN
    IF :members.salary NOT BETWEEN 10000 AND 75000 THEN
       message ('With no products, salary must be 10K-75K');
       RAISE FORM_TRIGGER_FAILURE;
    END IF;
  ELSE
    IF :members.salary NOT BETWEEN 20000 AND 85000 THEN
       message ('With products, salary must be 20K-85K');
       RAISE FORM_TRIGGER_FAILURE;
    END IF;
  END IF;
END;


Upd-mod: Please read the stickies at the beginning of this forum.

[Updated on: Sun, 22 April 2007 21:30] by Moderator

Report message to a moderator

Re: Newbie!! how do I create a trigger in my forms [message #232665 is a reply to message #232644] Sun, 22 April 2007 21:31 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
The table 'products' must exist in the database to which you are attached. Either the table does not exist or you have not signed on to a user that has access to it.

David
Re: Newbie!! how do I create a trigger in my forms [message #232835 is a reply to message #232644] Mon, 23 April 2007 09:07 Go to previous message
imen_mr2004
Messages: 22
Registered: October 2006
Location: tunisia
Junior Member
try to manage an exception, just try these intructions

DECLARE
NumberOfProducts NUMBER

BEGIN
begin
SELECT count(*)
INTO NumberOfProducts
FROM products
WHERE products.MemberID = :members.MemberID;
exception when others then NumberOfProducts:=0;
end;

IF NumberOfProducts = 0 THEN
IF :members.salary NOT BETWEEN 10000 AND 75000 THEN
message ('With no products, salary must be 10K-75K');
RAISE FORM_TRIGGER_FAILURE;
END IF;
ELSE
IF :members.salary NOT BETWEEN 20000 AND 85000 THEN
message ('With products, salary must be 20K-85K');
RAISE FORM_TRIGGER_FAILURE;
END IF;
END IF;
END;





Good luck;
don't forget to focus if u hav wrote he right name of table and columns, and if u had logged on.
Previous Topic: SET_BLOCK_PROPERTY
Next Topic: How to create a data block without table info
Goto Forum:
  


Current Time: Sat Dec 10 18:38:56 CST 2016

Total time taken to generate the page: 0.22518 seconds