Solved

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

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to free up undo space? 3 41
1 FROM DUAL wont work with additional columns ?? 4 37
create a nested synonym 4 25
Oracle encryption 12 31
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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 about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
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…

773 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