Re: Two questions in Oracle...

From: <markp7832_at_my-deja.com>
Date: Thu, 26 Aug 1999 13:57:17 GMT
Message-ID: <7q3h3m$nvc$1_at_nnrp1.deja.com>


In article <37C60AC9.5CB7A5B_at_comp.polyu.edu.hk>,   Jimmy <c6635500_at_comp.polyu.edu.hk> wrote:
> Hello all,
> I have two questions: (in Oracle 7.3.3)
>
> 1) Why the following SQL statement returns 'aaa'?
>
> select 'aaa' from dual where 'LOW_D_LIMIT' like 'L_%';
>
> Is '_' means special character? 'LOW_D_LIMIT' not contains the
> string like 'L_' and it should return 'no rows returned' I
> think......... but it returns 'aaa'....
>
Yes that is because the underscore is the single position wildcard so you asked to return all rows that start with L followed by any one character followed by any characters so you got what you asked for.

> 2) I want to develop a trigger like this:
>
> create or replace trigger testing
> after update or insert or delete on aaa
> begin
> if updating then
> if updating(fieldA) then
> pro1;
> end if;
> pro_all;
> elsif inserting then
> ...
> elsif deleting then
> ...
> end if;
> end;
> /
>
> If update column fieldA, then do pro1 and pro_all Other columns
> updating do only pro_all.
> However, errors in creating this trigger.... Is it possible to
check
> which column is updated in the updating part? I cannot do this:
>
> create or replace trigger testing
> after update(fieldA) or insert or delete on aaa
> ...
>
> since this trigger only fired if fieldA is updated.
>
> Thanks,
> Jimmy
>
I am not sure what is wrong with your trigger but I believe that you can do what you want. You will need to identify you table column names with old.column_name or new.column_name so Oracle knows which one you are referring to.

--
Mark D. Powell  -- The only advice that counts is the advice that
 you follow so follow your own advice --


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Thu Aug 26 1999 - 15:57:17 CEST

Original text of this message