Re: Error of validation
Date: Sat, 17 Mar 2007 11:54:03 +0100
DA Morgan wrote:
> nick048 wrote: >
>> Hi to All,
>> I a Form I have 2 Item 'FROM_CODE' AND 'TO_CODE'. Both are
>> VARCHAR2(18) with a format 18.104.22.168.999999.
>> For the Item TO_CODE I have the WHEN-VALIDATE-ITEM trigger:
>> If (NVL(:TO_CODE,'') < NVL(:FROM_CODE,'')) then
>> DISPLAY_MSG('Code Error', 'To code muts be > From code') ;
>> raise form_trigger_failure;
>> end if;
>> For example, if From code = '00.00.01.03.0100000' and To code =
>> '00.00.01.03.001000' the trigger work fine.
>> If From code = '00.00.01.03.0100000' and in To code NO VALUE, the
>> trigger don't return the error message.
>> How can resolve this problem ? I hope in Your help.
>> Best Regards
> > > What is the business rule? If there must be a TO_CODE then > REQUIRED in the property palette should be "Yes."
Your nvl is useless, when one of the codes is null you replace it with null.
This can be avoided by following our District Attorney's advice, but if you really want it in code:
if :to_code < :from_code
or :to_code is not null and :from_code is null
If you don't understand how null works, you'll have trouble with using :from_code further on in your code.
Gerard Received on Sat Mar 17 2007 - 11:54:03 CET