Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: To create the trigger

Re: To create the trigger

From: <Mujeeb_ur_Rehman_at_hotmail.com>
Date: Sat, 22 Aug 1998 05:05:05 GMT
Message-ID: <6rlji1$fj5$1@nnrp1.dejanews.com>


Hi :)

U can do like this



CREATE TRIGGER TEST
BEFORE INSERT OF ACC
FOR EACH ROW
declare
  ok number(1) := 1;
BEGIN
  IF acc_qty > ord_qty THEN
        SELECT ALLOW_FLAG INTO temp FROM TABLE WHERE ....
        IF temp = 'No' THEN
             ok := 0; /* It is not required but no harm having it either :) */
             raise_application_error(-10000,'You don't orderso much');
        END IF;

  END IF;
  IF ok = 1 THEN
    UPDATE;
  END IF;
END TEST;

Hope this help's.



In article <35df0eb6.22822445_at_news.twsc.pouchen.com.tw>,   violin.hsiao_at_mail.pouchen.com.tw (Violin) wrote:
> Hello,
> I want to create a trigger like this:
> CREATE TRIGGER TEST
> BEFORE INSERT OF ACC
> FOR EACH ROW
> BEGIN
> IF acc_qty > ord_qty THEN
> SELECT ALLOW_FLAG INTO temp FROM TABLE WHERE ....
> IF temp = 'No' THEN
> raise_application_error(-10000,'You don't orderso much');
> ELSE
> UPDATE_CLAUSE;
> END IF;
> ELSE
> UPDATE_CLAUSE;
> END IF;
> END TEST;
>

> My question is that the 2 UPDATE_CLAUSE are the same.
> If in normal,I type the UPDATE_CLAUSE twice,and compile,
> the trigger is created OK.
> Is there any convenient way but type the UPDATE_CLAUSE twice?
> Please give me some suggestion,Thank you in advance!
> Please Cc to : violin.hsiao_at_mail.pouchen.com.tw,Thanks :)
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Sat Aug 22 1998 - 00:05:05 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US