Solved

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

707 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