?
Solved

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

Posted on 2016-11-11
2
Medium Priority
?
75 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Steve Wales earned 2000 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 77

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

777 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