RE: how to exit scripts file if certain exception happens?

RE: how to exit scripts file if certain exception happens?

 

  

Make the Block you wrote as your outer most block.

SD



-----Original Message-----
From: Fang, Elaine [mailto:Elaine.[Email Address Removed] Thursday, February 28, 2002 3:48 PM
To: LazyDBA.com Discussion
Subject: RE: how to exit scripts file if certain exception happens?


Yes, it will run. But it will go to the following block and start building
table in user's default tablespace which is not what I want. What I want is
if the tablespace doesn't exist, then we just get out of the script w/o
building tables.

Thanks for pointing out v_cnt. I did have that declared in my file, just
didn't copies it here;-)

Thanks for your reply!

-----Original Message-----
From: Srinivasan, Ram [mailto:[Email Address Removed] Thursday, February 28, 2002 3:43 PM
To: Fang, Elaine; LazyDBA.com Discussion
Subject: RE: how to exit scripts file if certain exception happens?


You don't have to put anything there. It should rum. Declare the v_cnt
first.

Ram Srinivasan
PRA International, Inc.
4105 Lewis & Clark Drive
Charlottesville, VA 22911-5801
Tel: (434) 951-3365
Web: www.praintl.com


-----Original Message-----
From: Fang, Elaine [mailto:Elaine.[Email Address Removed] Thursday, February 28, 2002 3:21 PM
To: LazyDBA.com Discussion
Subject: how to exit scripts file if certain exception happens?


Hi,

I have a .sql file which checks the tablespace(user input) info first, and
if the check is successful, then create tables on that tablespace. What I
want to do is if no tablespace is found, then exit that script file. i.e.
don't build tables on that user's default tablespace (since most customer
didn't have that set up correctly).

Here is part of my script:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
DECLARE
NO_TS EXCEPTION;
BEGIN
SELECT COUNT(*) INTO v_cnt FROM user_tablespaces WHERE tablespace_name =
'&xTblSps';
IF v_cnt <1 THEN
RAISE NO_TS;
END IF;
EXCEPTION
WHEN NO_TS THEN
DBMS_OUTPUT.PUT_LINE('No tablespace with that name found. ');
-- ??? what should I put here to exit the whole script file???
END;
/

Table building block .....
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Thanks!

EF











--------
Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html

--------
Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page