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)
 T-SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-27 : 08:56:25
Nibeditas writes "I am a software programmer. Right now I am working on the conversion of PL/SQL script to T-sql Script.

I have a few problems:

Can you tell me what will be the corresponding error numbers (@@Error) for the following SQL Codes in PL/SQL(Oracle):
1. -54
2. -1
3. -1400
4. -2290
5. -2291
6. -2292
7. -1407

Also, I wanted to know how Functions are called in T-SQL?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-27 : 09:07:46
Without the error descriptions, AND the circumstances that caused the error, the code numbers are meaningless. There's no correlation between an Oracle error and a SQL Server error, certainly not by error number alone. SQL Server can handle some situations without throwing an error, while Oracle would; the reverse is also true.

Functions in T-SQL do not use the Oracle FN syntax, otherwise they work exactly like functions in every other programming language:

function_name(parameter1, parameter2)

I would recommend that you DO NOT try to translate line-by-line when converting Oracle to SQL Server, you'll only get frustrated. You should instead take a full view of what the procedure does, what the problems are, and what the end result is supposed to be, then write T-SQL to accomplish it, WITHOUT re-using or converting the Oracle code.

If you're not familiar with T-SQL, then you should take time to study it. Especially if you use cursors in your Oracle code, there are much better ways to perform operations in T-SQL without using cursors.

It may seem like a lot more work to start over, but it will save you a lot of time later when trying to maintain the code. T-SQL and PL/SQL are different languages, they have different strengths and weaknesses. You are better off writing code that takes advantage of each one's strengths than trying to find a compromise code that works with both.

Go to Top of Page
   

- Advertisement -