Re: problem with a trigger

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Fri, 12 Dec 2003 08:59:11 -0800
Message-ID: <1071248256.707306_at_yasure>


Tiago Rocha wrote:
> 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..

>
>
> 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
> IF TO_NUMBER(TO_CHAR(:NEW.RES_DATE,'d')) = 7
> THEN raise_application_error(-20000,'We are closed on sunday');
> END IF;
> END;
It has nothing to do with which version of the database. It is related to language and sort parameters.
-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Fri Dec 12 2003 - 17:59:11 CET

Original text of this message