Try putting the select in an enclosing block, ie: -

begin
    SELECT my_id INTO v_temp
    FROM my_tablee
    WHERE my_id = v_number;     
exception
    when NO_DATA_FOUND then
       do_something;
end;
use_v_temp;

HTH
David Lord

-----Original Message-----
Sent: 27 April 2001 15:41
To: Multiple recipients of list ORACLE-L


Gurus,

In my Oracle 8.1.7 stored procedure, I'm selecting into a variable and need
to check to see if anything was found but I get an exception when there are
no records.  I guess I could select count() and check the returned count
number but I thought there might be a better way.  Any ideas?

    SELECT my_id INTO v_temp
    FROM my_tablee
    WHERE my_id = v_number;
    IF SQL%FOUND THEN
        p_error_code := 100;
        RETURN;
    END IF;


TIA,

Woody

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Woody Mckay
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
**********************************************************************
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they   
are addressed. If you have received this email in error please notify 
the system manager.

This footnote also confirms that this email message has been swept by 
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Lord David
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to