Re: Forms: SELECT returns 1 or 0
Date: Fri, 8 Jul 1994 13:46:37 GMT
Message-ID: <1994Jul8.134637.1_at_skcla.monsanto.com>
In article <CsJ8xH.Avp_at_undergrad.math.uwaterloo.ca>,
aarhemtu_at_cayley.uwaterloo.ca (Anil) writes:
> In and using FORMS 4 with Oracle 7.
>
> In one of my blocks I am trying to create a trigger to load a phone
> number based upon the office in the block. So I created a "POST-QUERY"
> trigger as follows:
>
> SELECT phone_number
> INTO :my_block.phone_number
> FROM phone_table
> WHERE office = :my_block.office;
>
>
> This works great, except that some offices do NOT have phone numbers. So,
> the select state does not return anything. I would like the phone number
> item to remain empty in these cases yet I get an Oracle Forms error telling
> me that NO_DATA_FOUND.
>
>
> Help.
>
>
> Thanks,
> Anil
Try handling the NO_DATA_FOUND exception in the trigger - something like:
BEGIN
SELECT phone_number
INTO :my_block.phone_number
FROM phone_table
WHERE office = :my_block.office;
EXCEPTION
WHEN NO_DATA_FOUND THEN
:my_block.phone_number = '';
END
This may not be syntactically correct!
Bob Schofield - G.D.Searle - Monsanto Received on Fri Jul 08 1994 - 15:46:37 CEST