Re: problem with a trigger

From: Tiago Rocha <tiagocrspamtalho_at_terra.com.br>
Date: Fri, 12 Dec 2003 11:08:00 -0300
Message-ID: <qkijtv8l456fn7r0lro3nc7ck89d0n4cfm_at_4ax.com>


[Quoted] On Fri, 12 Dec 2003 13:57:29 GMT, "BlackEagle" <slimane_at_tsk.be> wrote:

>I'm using 9.0, it's just my opinion, I don't exactly know why..

[Quoted] As Frank said, it must be something with NLS setting. I use American/America...

>but I still haven't got any help with my trigger.
>Frank? Tiago?
>can't you help me out on this?

this is your trigger:
DECLARE
res_date date;

   BEGIN
   IF TO_NUMBER(TO_CHAR(to_date(res_date,'dd-mon-yyyy'),'d')) = 7      THEN raise_application_error(-20000,'We are closed on sunday');    END IF; I think I know what the problem is.

You have DECLAREd "res_date" as being date, and then you do "to_date( res_date..."

You don't need that "to_date", because the "res_date" variable is already a "date".

Also, you aren't assigning any value to "res_date". Is "res_date" a column? If so, rewrite your trigger to look more or less like this:

DECLARE
   BEGIN
[Quoted]    IF TO_NUMBER(TO_CHAR(:NEW.RES_DATE,'d')) = 7      THEN raise_application_error(-20000,'We are closed on sunday');    END IF;
END;

-- 
Tiago Rocha
Recife - Brasil
www.diariodastrilhas.cjb.net
Received on Fri Dec 12 2003 - 15:08:00 CET

Original text of this message