Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> SQL Default Question (Resent)

SQL Default Question (Resent)

From: Norman Dunbar <Norman.Dunbar_at_lfs.co.uk>
Date: Wed, 26 Feb 2003 09:52:28 -0000
Message-ID: <E2F6A70FE45242488C865C3BC1245DA7035A2D9D@lnewton.leeds.lfs.co.uk>


Morning,

This is untested and off the top of my head, and it is still quite early in the morning, and it is raining, so :

begin

        ....

	begin
		select a into num1 from t1;
	exception
		when no_data_found then
			num1 := 0;
	end;

	begin
		select b into num2 from t2;
	exception
		when no_data_found then
			num2 := 0;
	end;

	...

exception
	stuff here

end;
/

You have to code each access to the database in it's own begin/exception/end block otherwise that fact that there is no data to select will cause the procedure to barf.

HTH Regards,
Norman.



Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar_at_LFS.co.uk
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com

-------------------------------------

-----Original Message-----
From: abc [mailto:abc_at_abc.com.au]
Posted At: Wednesday, February 26, 2003 3:41 AM Posted To: server
Conversation: SQL Default Question (Resent) Subject: SQL Default Question (Resent)

Hi All,

I have a PL/SQL to do following calculation:

Total = NUM1 + NUM2;

SELECT a INTO NUM1 FROM T1;
SELECT b INTO NUM2 FROM T2;

<SNIP> Received on Wed Feb 26 2003 - 03:52:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US