Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Exception clause

Author  Topic 

Dan_2004
Starting Member

13 Posts

Posted - 2004-02-24 : 10:20:35
Hi,
I would like to know if there has something that correspond to the PL/SQL exception clause in T-SQL?
The code, for example, in PL/SQL is:
EXCEPTION
WHEN UTL_FILE.INVALID_PATH THEN
dbms_output.put_line('INVALID PATH');

Now, do you have a solution to resolve it in T-SQL?

Thanks in advance,

Daniel

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2004-02-25 : 14:30:44
Daniel,

There is no EXCEPTION clause in T-SQL. The closest will be when Yukon comes out, using Try...Catch. For now, you have to check whether the value of @ERROR is something other than zero. But be warned that EVERY command resets the value of @ERROR, so if you need to know what that value is, you have to assign it to another variable FIRST and then check it, otherwise your IF @ERROR <> 0 statement will reset it to zero so the next line would no longer know what it was.

--------------------------------------------------------------
Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url]
Go to Top of Page
   

- Advertisement -