Solved

Converting some Oracle code. Need help from Oracle expert who knows sql server

Posted on 2016-11-11
2
48 Views
Last Modified: 2016-11-13
I am converting some SQL server code to Oracle. Can someone tell me if my conversion code looks correct? I am not familiar with the OUT variable in sql server as I have never used it before.

Sql Server :
EXEC sp_executesql @lokSqlString, @lokSqlParameter, @lnAudit OUT

The Orcacle code I converted to. Is it correct?

EXECUTE IMMEDIATE sp_executesql @lokSqlString, @lokSqlParameter, @lnAudit OUT
0
Comment
Question by:brgdotnet
2 Comments
 
LVL 22

Accepted Solution

by:
Steve Wales earned 500 total points
ID: 41884748
You might want to first have a read of the EXECUTE IMMEDIATE documentation:  
http://docs.oracle.com/database/121/LNPLS/executeimmediate_statement.htm#LNPLS01317
http://docs.oracle.com/database/121/LNPLS/dynamic.htm#BHCEBBAI

Oracle doesn't use the @variable syntax.  So drop the '@'

I haven't done a lot of work with execute immediate and in/out parameters so the below may not be exact syntax:

EXECUTE IMMEDIATE lokSqlString USING lokSqlParameter  RETURNING INTO lnAudit

Something like that anyway.  Without knowing exactly what your SQL is doing hard to be more exact.

But the second documentation like above has several examples.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 41884929
Personally, I wouldn't try a direct port from SQL Server to Oracle.

There are things you may need to do in SQL Server that you don't need to do in Oracle.  Many times a direct port results in Oracle code that doesn't perform as well as it could.

If you can post the specifics we can probably provide the best way to do it in Oracle.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now