Solved

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

Posted on 2016-11-11
2
35 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

760 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

22 Experts available now in Live!

Get 1:1 Help Now