Sybase to Oracle Stored Procedure migration Help
Hello,
There is a Stored Procedure in Sybase and needs to be migrated to Oracle 10g. I need some quick help in creating temporary table and store the result set temporary. Here's the script.
Select distinct WC_POSITION_D.WID,
WC_POSITION_D.POSITION_NAME,
WC_POSITION_D.CURR_MTH_CAPACITY,
WC_POSITION_D.NEXT_MTH_CAPACITY into #capcity
from WC_POSITION_D
***********Below SQL extract no.of skills per position for the currentMonth Active ********************
select WC_POSN_SKILL_F.POSN_WID,
count(WC_POSN_SKILL_F.SKILL_WID) as curr_skills into #currskills
from WC_POSN_SKILL_F
where WC_POSN_SKILL_F.Flag = 'A'
group by WC_POSN_SKILL_F.POSN_WID
***********Below SQL extract no.of skills per position for the NextMonth Active ********************
select WC_POSN_SKILL_F.POSN_WID,
count(WC_POSN_SKILL_F.SKILL_WID) as next_skills into #nextskills
from WC_POSN_SKILL_F
group by WC_POSN_SKILL_F.POSN_WID
***********Below SQL calculates CURR_MNTH_DMD,NEXT_MNTH_EXP_DMD per position ********************
select #capacity.WID,
((#capacity.CURR_MTH_CAPACITY)/curr_skills) as CURR_MTH_DMD,
((#capacity.NEXT_MTH_CAPACITY)/next_skills) as NEXT_MTH_DMD into #demand
from #capacity, #skills
where #capacity.WID = #skills.POSN_WID
***********Below statement populate CURR_MNTH_DMD,NEXT_MNTH_EXP_DMD in WC_POSN_SKILL_F ********************
UPDATE WC_POSN_SKILL_F
set WC_POSN_SKILL_F.CURR_MNTH_DMD = #demand.CURR_MTH_DMD, WC_POSN_SKILL_F.NEXT_MNTH_EXP_DMD = #demand.NEXT_MTH_DMD
from WC_POSN_SKILL_F,#demand
where WC_POSN_SKILL_F.POSN_WID = #demand.WID
any kind of immediate help/input appreciated.
Be careful porting code like this directly. Reason:
The reasons for using Temporary Tables in Sybase is invalid in Oracle.
In Sybase one needs to minimize locks and lock contention and escalation. This is done using temporary tables. Your Sybase script is typical of this approach - which is valid in Sybase.
However, this is not valid in Oracle. Oracle is at its core designed very differently from Sybase. A single lock in Oracle has the same overheads as a million locks - none. In Oracle, readers-of-data cannot block writers-of-data and vice versa. In Oracle there is no lock escalation - ever. This concept/problem does not exist. Period.
Porting your Sybase code to Oracle will be an attempt at using Oracle as a Sybase. Oracle is a very poor Sybase.
I urge you not to do a direct port. You will become very frustrated with Oracle. You will conclude that Oracle sucks. Use Oracle as it has been designed.. or IMO, bluntly put, do not use it all.
Similar Messages
-
JReport Designer - oracle stored procedure-PLS HELP!!!!
Hi,
I am using Jreport designer with oracle data base. I wanted to layout a report with oracle stored procedure which returns a REF CURSOR. I tried adding OracleProcedureUDS in user data source thru catalog browser. I gave the params as DRIVER=oracle.jdbc.driver.OracleDriver&URL="jdbc:oracle:thin:@10.10.1.177:1521:ORCL"
&USER=<myuser>&PSWD=<mypwd>&PROCNAME=empquery&SQL={ call empquery(?) }
&REFCURSORINDEX=1
but on pressing OK, i get the error ,
java.lang.NullPointerException
at jet.datasource.oracle.OracleProcedureUDS.getProcedureParams(jet/datas
ource/oracle/OracleProcedureUDS)
at jet.datasource.oracle.OracleProcedureUDS.getResultSet(jet/datasource/
oracle/OracleProcedureUDS)
at jet.universe.engine.UUDSEngine._getResultSet(jet/universe/engine/UUDS
Engine)
at jet.universe.engine.UQueryEngine.getResultSet(jet/universe/engine/UQu
eryEngine)
at jet.rptengine.JReportEngine.run(jet/rptengine/JReportEngine)
at java.lang.Thread.run(Thread.java:536)
java.lang.NullPointerException
at jet.datasource.oracle.OracleProcedureUDS.getProcedureParams(jet/datas
ource/oracle/OracleProcedureUDS)
at jet.datasource.oracle.OracleProcedureUDS.getResultSet(jet/datasource/
oracle/OracleProcedureUDS)
at jet.universe.engine.UUDSEngine._getResultSet(jet/universe/engine/UUDS
Engine)
at jet.universe.engine.UQueryEngine.getResultSet(jet/universe/engine/UQu
eryEngine)
at jet.rptengine.JReportEngine.run(jet/rptengine/JReportEngine)
at java.lang.Thread.run(Thread.java:536)
note: I have added the classpath C:\oracle\ora92\jdbc\lib\class111.zip which contains the classes in package oracle.jdbc.driver, as per the user guide.
also this is my stored procedure which got created successfully:
CREATE OR REPLACE PACKAGE SHDEMO as
type curtype is ref cursor;
END SHDEMO;
CREATE OR REPLACE PROCEDURE empquery (cur OUT SHDEMO.curtype) as
lcur SHDEMO.curtype;
begin
open lcur for
select * from intf_hr_employee;
cur:=lcur;
END empquery;
pls somebody help me. I have wasted 2 days on this.
Thanks,
SwathiHi,
i fixed the bug. it was because i excluded &OWNER=<MYOWNER> in the param list.
Thanks,
Swathi -
Help Required on Cross Referencing with Oracle Stored Procedure
Hi Experts,
I have a requirement which is having the requirements as follow,
Web Application initially sends a request number to SAP ECC to fetch the response details through SAP PI (HTTP to RFC u2013 Synchronous). While fetching the response from SAP ECC system, SAP PI has to invoke a Oracle Stored Procedure based on some parameter from SAP ECC System and then composited data has to send back to Web Application by SAP PI.
Request you to kindly suggest how to achieve the above. JDBC lookup is not much extended to call stored procedure. It would be helpful if it will be a step by step as I am novice to SAP PI.
Regards
Archanayou might very well have to use a BPM.
open a sync/async bridge ->
do a sync call to RFC ->
Do a sync call to DB (use SP here) ->
do a transformation from the response message of RFC and Response of DB (N:1) to for your response to original caller (http)
Close the sync async bridge using the response message -
Help : To convert Following Code into oracle Stored Procedure
Hi All
I m Ajay Patel
N i m new in Oracle i don't know much abt oracle
I want to convert following code in to oracle10g ( Procedure )
This is PHP code n this function abt compound interest.
$pa,$ri,$sy,$ey :- all are in parameters
all variable declare with $
$pa - is principle amount
$ri - Rate
$sy - start year - 2009
$ey - end year - 2060
function CCI($pa,$ri,$sy,$ey)
$CCI = array();
$totalyear = $ey - $sy;
$ri = $ri/100;
$ri= 1 + $ri;
$amt=1;
for($i=1;$i<=($totalyear+1);$i++)
if($i==1)
$CCI[$i][0] = $sy;
$CCI[$i][1] = $pa;
else
$powvalue = 1;
for($k=1;$k<$i;$k++)
$powvalue = $ri * $powvalue;
$FinalValue = $pa * $powvalue;
$CCI[$i][0] = $sy;
$pos = strpos($FinalValue, '.');
if ($pos !== false)
$FinalValue = substr($FinalValue, 0, $pos+3 );
$CCI[$i][1] = $FinalValue ;
$sy++;
return $CCI;
Pls Help Me to convert above code in to oracle stored procedure
Thanks All
Regards,
AjayIts time to start reading the Document .
-
Help with Data service built on a Oracle Stored Procedure
Hi Friends,
I am absolutely new to ALDSP and I have created a data service on a Oracle stored procedure. Working with ALDSP 2.5.
The dataservice is working fine as it is retrieving the data from the database by calling the stored procedure. the signature of the procedure is as follows :
sp_get_rpt(commID IN number,hier1 IN varchar2,hier2 IN varchar2,ref_cur Ref_cursor)
Query 1>>
When i executed the data service, realised that it is considering only the first parameter as compulsary. Even i do not enter the remaining parameters the SP is being
called.
Is there any way I can control the input parameters, in the sense that specify in the data service itself which parameter is compulsary and which one is not(could be nullable) ?
Query 2>>
The same case with the output that is returned by the sp, I have defined it as a XML schema. as the output of the sp is
a ref cursor.
the output returned by the sp, may have some fields as Null, but this is not being accepted by the o/p schema that I have defined in ALDSP.
Please let me know how I can make some fields nullable in the o/p schema too so that the result set is returned even if some fields are null.
-ThanksIn DSP 2.5, there are no provisions for passing null parameters via the client API. You can pass a null parameter when calling one data service function from another data service function by passing a empty element (i.e. $CUSTOMER/MIDDLE_NAME where this particular CUSTOMER doesn't have a MIDDLE_NAME) or by passing an empty sequence (). The function argument must be defined as occuring zero or one times (i.e. $myArg as xs:string? ) the question mark indicates zero or one occurrences.
Use the same notation to indicate that OUT args are optional.
For returned rowsets with optional columns, indicate this with minOccurs="0" in your schema.
I'm thinking that DSP does not handle ref_cursor arguments - but hey, if you tried it and it works, I won't argue.
In DSP 2.5, you will need a patch from CR346161 to pass null Date (date) or TimeStamp (dateTime) elements to an Oracle stored procedure. Contact customer support if you need this patch. -
Customize the stored procedure migrating of MWB
Hi, All,
Is there anybody know how much customize we can have for using
the MWB when migrate stored procedure? For sample I have a SQL
Server 6.5 strored procedure like following:
/******************* SQL Server 6.5 sp *************/
CREATE PROCEDURE sp_SelectUsers
AS
select
tbl_Sp_users.ID, UserName, Password, ExpiresOn,
PwdChangedDate, tbl_Sp_UserGrps.name
from
tbl_Sp_users, tbl_Sp_UserGrps
where
GroupID = tbl_Sp_UserGrps.id
order by username
/******************* end ***************************/
After I migrate it to Oracle 8 with MWB, I got following object,
one Pkg and one Procedure in Oracle db, like following:
/****************** Oracle Pkg **********************/
CREATE OR REPLACE PROCEDURE sp_SelectUsers(
RC1 IN OUT sp_SelectUsersPkg.RCT1)
AS
StoO_selcnt INTEGER;
StoO_error INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
StoO_sqlstatus INTEGER;
BEGIN
OPEN RC1 FOR
SELECT tbl_Sp_users.ID, UserName, Password,
ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
tbl_Sp_users, tbl_Sp_UserGrps
WHERE GroupID = tbl_Sp_UserGrps.id
ORDER BY username ;
END sp_SelectUsers;
/******************* Oracle Procedure ****************/
PROCEDURE sp_SelectUsers(
RC1 IN OUT sp_SelectUsersPkg.RCT1)
AS
StoO_selcnt INTEGER;
StoO_error INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
StoO_sqlstatus INTEGER;
BEGIN
OPEN RC1 FOR
SELECT tbl_Sp_users.ID, UserName, Password,
ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
tbl_Sp_users, tbl_Sp_UserGrps
WHERE GroupID = tbl_Sp_UserGrps.id
ORDER BY username ;
END sp_SelectUsers;
/******************* end *****************************/
As our client use RDO as access method, there is no way we can
use this migrated SP in RDO and return resultset. We need
convert this SP to following to be able to use RDO to get
resultset back in client:
/******************* need convert to *********************/
create or replace package sp_selectUsersPkg
as
cursor c1
is select tbl_Sp_users.ID, UserName, Password,ExpiresOn,
PwdChangedDate, tbl_Sp_UserGrps.name
from tbl_Sp_users, tbl_Sp_UserGrps
where GroupID = tbl_Sp_UserGrps.id
order by username;
type UsersCur
is ref cursor return c1%ROWTYPE;
procedure sp_selectUsers(UserCursor in out UsersCur );
END;
create or replace package body sp_selectUsersPkg
as
procedure sp_selectUsers(UserCursor in out UsersCur )
is
begin
open UserCursor for
select tbl_Sp_users.ID, UserName,
password, ExpiresOn,
PwdChangedDate, tbl_Sp_UserGrps.name
from tbl_Sp_users, tbl_Sp_UserGrps
where GroupID = tbl_Sp_UserGrps.id
order by username;
end;
end;
/******************* end *********************************/
Is there any idea how we can do this? I hope we don't need do
this manually.
Thank you very much for any help!
Jing
nullI have done a rough example of using VB6, RDO and ODBC
drivers, which may be of help to some workbench users:
Calling Oracle 8.1.5 stored procedures with ref cursors using RDO
and Visual
Basic.
Ver 0.1 [email protected]
Summary
Versions Used
Table
Code
With Explicit Ref Cursor Argument
Without Explicit Ref Cursor Argument
Actions
Summary
This gives a comparison of the connectivity between Visual Basic
and Oracle,
with both the intersolve and oracle drivers. The Oracle odbc
still has
significant
shortcomings in comparison to the intersolve/Merant driver.
Versions Used
Visiual Basic 6.0, Oracle odbc driver 8.1.5.3.0, Oracle Database
8.1.5.0.0 on
NT, intersolve/Merant 3.5 32 bit Oracle driver.
Table
html table replaced by rough results in ascii form
test case with named result set cursor variable:
sSQL = "{CALL reftest.GetEmpData(?)}"
oracle 8.1.5.3
could not find item indicated by text, known vb6.0 bug?, thinks
reftest is user
intersolve
could not find item indicated by text, known vb6.0 bug?, thinks
reftest is user
sSQL = "begin reftest.GetEmpData(?); end;"
oracle 8.1.5.3
run time error 40002 driver not capable
intersolve
ok
sSQL = "{CALL GetEmpData(?)}"
oracle 8.1.5.3
run time error 40002 driver not capable
intersolve
could not find item indicated by text,?(similar to bug above?)
at qd.rdoParameters(0).Type = rdTypeVARCHAR
sSQL = "begin GetEmpData(?); end;"
oracle 8.1.5.3
run time error 40002 driver not capable
intersolve
ok
procedure with result set last argument wanting to be simulated
as not
argument result set
strsql = "{CALL BYROYALTYPkg.byroyalty()}"
oracle 8.1.5.3
ok
intersolve
ok
strsql = "begin BYROYALTYPkg.byroyalty(); end;"
oracle 8.1.5.3
wrong number of arguments in byroyalty
intersolve
ok
strsql = "{CALL byroyalty() }"
oracle 8.1.5.3
wrong number of arguments
intersolve
ok
strsql = "begin byroyalty(); end;"
oracle 8.1.5.3
wrong number of arguments
intersolve
ok
Code
With Explicit Ref Cursor Argument
Oracle Stored Procedures and Packages
(on scott/tiger account)
create or replace package reftest as
cursor c1 is select ename from emp;
type empCur is ref cursor return c1%ROWTYPE;
procedure GetEmpData(EmpCursor in out empCur );
END;
create or replace package body reftest as
procedure GetEmpData(EmpCursor in out empCur) is
begin
open EmpCursor for select ename from emp;
end;
end;
create or replace procedure GetEmpData(EmpCursor in out
reftest.empCur)
is
begin
open EmpCursor for select ename from emp;
end;
VB code
Private Sub Command1_Click()
Dim cn As New rdoConnection
Dim qd As rdoQuery
Dim rs As rdoResultset
Dim cl As rdoColumn
Static Number As Integer
Number = 0
cn.Connect = "uid=scott; pwd=tiger; DSN=Oracle;"
'enable the MS Cursor library
cn.CursorDriver = rdUseOdbc
'Make the connection
cn.EstablishConnection rdDriverPrompt
sSQL = "BEGIN GetEmpData(?); END;"
Set qd = cn.CreateQuery("", sSQL)
qd.rdoParameters(0).Type = rdTypeVARCHAR
'Dynamic or Keyset is meaningless here
Set rs = qd.OpenResultset(rdOpenStatic)
'all the output is routed to the debug window
Debug.Print ".....Starting Result Sets....."
Do
Debug.Print
Debug.Print
Do Until rs.EOF
For Each cl In rs.rdoColumns
If IsNull(cl.Value) Then
Debug.Print " "; cl.Name; "NULL"; 'Error
trap for
null fields
Else
Debug.Print " "; cl.Name; " ";
cl.Value;
End If
Next
Debug.Print
rs.MoveNext
Loop
Loop While rs.MoreResults
cn.Close
End Sub
Without Explicit Ref Cursor Argument
Oracle Stored Procedures and Packages
(requires table:
SQL> desc MTG_VERSION
Name
Null?
Type
VERSION
NUMBER
create or replace PACKAGE BYROYALTYPkg AS
TYPE RT1 IS RECORD (
val MTG_VERSION.VERSION%TYPE
TYPE RCT1 IS REF CURSOR RETURN RT1;
PROCEDURE byroyalty(
RC1 IN OUT BYROYALTYPkg.RCT1);
END;
create or replace PACKAGE BODY BYROYALTYPkg AS
PROCEDURE byroyalty(
RC1 IN OUT BYROYALTYPkg.RCT1)
AS
StoO_selcnt INTEGER;
StoO_error INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
StoO_sqlstatus INTEGER;
BEGIN
OPEN RC1 FOR
SELECT VERSION FROM MTG_VERSION;
END byroyalty;
END;
create or replace PROCEDURE byroyalty(
RC1 IN OUT BYROYALTYPkg.RCT1)
AS
StoO_selcnt INTEGER;
StoO_error INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
StoO_sqlstatus INTEGER;
BEGIN
OPEN RC1 FOR
SELECT VERSION FROM MTG_VERSION;
END byroyalty;
VB code
Dim env1 As rdoEnvironment
Dim conn1 As rdoConnection
Dim strsql As String
Dim ps As rdoPreparedStatement
Dim rs As rdoResultset
Private Sub Command1_Click()
strsql = "begin byroyalty(); end;"
'in oracle odbc driver uses refcusor argument to
get result set
Set ps = conn1.CreatePreparedStatement("PsTest",
strsql)
Set rs = ps.OpenResultset(rdOpenStatic)
Text1 = rs!Version
rs.Close
End Sub
Private Sub Form_Load()
rdoEngine.rdoDefaultCursorDriver = rdUseOdbc
Set env1 = rdoEngine.rdoCreateEnvironment(" ", " ", " ")
strsql = "ODBC;DSN=tot4;UID=test;PWD=test;"
Set conn1 = env1.OpenConnection(" ", rdDriverPrompt, False,
strsql)
conn1.QueryTimeout = 3600
End Sub
Actions
Encourage odbc to allow result sets , via the odbc processed
extra
argument, outside of packages.
Document the current situation, and keep users informed of
developments.
Turloch
Oracle Migration Workbench Team
Turloch O'Tierney (guest) wrote:
: Jing,
: Note that there is an example in the FAQ where the intersolve
: driver was used so no change was required in the client code.
The
: intersolve driver optionally converts the extra argument into a
: result set. With the Oracle ODBC driver the argument needs to
be
: explicitly handled.
: Is there a problem with RDO and the 8.0.5 ODBC driver handling
: package references?
: Turloch
: Turloch O'Tierney
: Oracle,
: Migration and Technology Group.
: FAQ entry reproduced:
: How are result sets/dynasets returned to the calling program?
: The Oracle Migration Workbench parser adds an extra
argument
: of type REF CURSOR for result
: sets/dynasets. This type is understood and can be
: manipulated by both PL/SQL and Oracle JDBC. Oracle8
: release 8.0.5 ODBC drivers support REF CURSORs which means
: that the additional argument must be
: explicitly handled by the application, and the client
: application code must be changed. However, some
: third-party vendors such as Intersolv supply ODBC drivers
: for Oracle that support REF CURSORs and can, in
: addition, implicitly make use of REF CURSORs for using
: result sets/dynasets. Therefore, no change is
: required in the client application code. This is
illustrated
: in the following examples of an MS SQL Server
: stored procedure and its equivalent Oracle package and
: stored procedure as generated by the Oracle
: Migration Workbench parser.
: MS SQL Server Stored Procedure
: CREATE PROCEDURE byroyalty
: AS
: select au_id from titleauthor
: GO
: Oracle8i Package and Stored Procedure
: PACKAGE BYROYALTYPkg AS
: TYPE RT1 IS RECORD (
: au_id titleauthor.au_id%TYPE
: TYPE RCT1 IS REF CURSOR RETURN RT1;
: END;
: PROCEDURE byroyalty(
: RC1 IN OUT byroyaltyPkg.RCT1)
: AS
: StoO_selcnt INTEGER;
: StoO_error INTEGER;
: StoO_rowcnt INTEGER;
: StoO_errmsg VARCHAR2(255);
: StoO_sqlstatus INTEGER;
: BEGIN
: OPEN RC1 FOR
: SELECT au_id FROM titleauthor;
: END byroyalty;
: The following example illustrates the typical ODBC code
used
: by Intersolv to call the above MS SQL Server
: stored procedure. This code also works for the above
: Oracle8i package and stored procedure. Note that error
: handling must be added in a real application:
: SQLPrepare(...,'{call byroyalty()}',...)
: SQLExecute()
: SQLBindCol()
: SQLFetch()
: Comments:
: SQLPrepare(...,'{call byroyalty()}',...) is the ODBC SQL
: syntax used to execute stored procedures.
: SQLExecute()executes the stored procedure.
: SQLBindCol()assigns storage for result column 1 in the
: result set (au_id).
: SQLFetch() fetches the first record from the result set
: generated by the stored procedure.
: The following examples illustrate how to call the above MS
: SQL Server stored procedure with result
: sets/dynasets in Visual Basic using DAO and RDO on top of
: ODBC. This code works for Oracle8i packages
: and stored procedures if you use an Intersolv ODBC driver
to
: understand Oracle REF CURSORs.
: DAO
: Private Sub Command2_Click()
: Dim sSql As String
: sSql = "{call byroyalty()}"
: 'In Oracle ODBC driver use refcusor argument to get
: result set
: Set rCustomers = dbsServer.OpenRecordset(sSql,
: dbOpenDynamic)
: Text4 = rCustomers.Fields(0)
: theend:
: End Sub
: Please note, this example assumes that a DAO connection
has
: been set up already.
: RDO
: Private Sub Command1_Click()
: StrSql = "{call byroyalty}"
: 'in oracle odbc driver uses refcusor argument to get
: result set
: Set Ps = connx1.CreatePreparedStatement("PsTest",
: StrSql)
: Set Rs = Ps.OpenResultSet(rdOpenStatic)
: Text3 = Rs!au_id
: Rs.Close
: End Sub
: Please note, this example assumes that an RDO connection
has
: been set up already.
: Jing Zhang (guest) wrote:
: : Hi, All,
: : Is there anybody know how much customize we can have for
using
: : the MWB when migrate stored procedure? For sample I have a
SQL
: : Server 6.5 strored procedure like following:
: : /******************* SQL Server 6.5 sp *************/
: : CREATE PROCEDURE sp_SelectUsers
: : AS
: : select
: : tbl_Sp_users.ID, UserName, Password, ExpiresOn,
: : PwdChangedDate, tbl_Sp_UserGrps.name
: : from
: : tbl_Sp_users, tbl_Sp_UserGrps
: : where
: : GroupID = tbl_Sp_UserGrps.id
: : order by username
: : /******************* end ***************************/
: : After I migrate it to Oracle 8 with MWB, I got following
: object,
: : one Pkg and one Procedure in Oracle db, like following:
: : /****************** Oracle Pkg **********************/
: : CREATE OR REPLACE PROCEDURE sp_SelectUsers(
: : RC1 IN OUT sp_SelectUsersPkg.RCT1)
: : AS
: : StoO_selcnt INTEGER;
: : StoO_error INTEGER;
: : StoO_rowcnt INTEGER;
: : StoO_errmsg VARCHAR2(255);
: : StoO_sqlstatus INTEGER;
: : BEGIN
: : OPEN RC1 FOR
: : SELECT tbl_Sp_users.ID, UserName, Password,
: : ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
: : tbl_Sp_users, tbl_Sp_UserGrps
: : WHERE GroupID = tbl_Sp_UserGrps.id
: : ORDER BY username ;
: : END sp_SelectUsers;
: : /******************* Oracle Procedure ****************/
: : PROCEDURE sp_SelectUsers(
: : RC1 IN OUT sp_SelectUsersPkg.RCT1)
: : AS
: : StoO_selcnt INTEGER;
: : StoO_error INTEGER;
: : StoO_rowcnt INTEGER;
: : StoO_errmsg VARCHAR2(255);
: : StoO_sqlstatus INTEGER;
: : BEGIN
: : OPEN RC1 FOR
: : SELECT tbl_Sp_users.ID, UserName, Password,
: : ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
: : tbl_Sp_users, tbl_Sp_UserGrps
: : WHERE GroupID = tbl_Sp_UserGrps.id
: : ORDER BY username ;
: : END sp_SelectUsers;
: : /******************* end *****************************/
: : As our client use RDO as access method, there is no way we
can
: : use this migrated SP in RDO and return resultset. We need
: : convert this SP to following to be able to use RDO to get
: : resultset back in client:
: : /******************* need convert to *********************/
: : create or replace package sp_selectUsersPkg
: : as
: : cursor c1
: : is select tbl_Sp_users.ID, UserName, Password,ExpiresOn,
: : PwdChangedDate, tbl_Sp_UserGrps.name
: : from tbl_Sp_users, tbl_Sp_UserGrps
: : where GroupID = tbl_Sp_UserGrps.id
: : order by username;
: : type UsersCur
: : is ref cursor return c1%ROWTYPE;
: : procedure sp_selectUsers(UserCursor in out UsersCur );
: : END;
: : create or replace package body sp_selectUsersPkg
: : as
: : procedure sp_selectUsers(UserCursor in out UsersCur )
: : is
: : begin
: : open UserCursor for
: : select tbl_Sp_users.ID, UserName,
: : password, ExpiresOn,
: : PwdChangedDate, tbl_Sp_UserGrps.name
: : from tbl_Sp_users, tbl_Sp_UserGrps
: : where GroupID = tbl_Sp_UserGrps.id
: : order by username;
: : end;
: : end;
: : /******************* end *********************************/
: : Is there any idea how we can do this? I hope we don't need do
: : this manually.
: : Thank you very much for any help!
: : Jing
Oracle Technology Network
http://technet.oracle.com
null -
BO v5.1 - creating a report from an oracle stored procedure
Post Author: newrochelle
CA Forum: Publishing
hi to all,
im using BO 5.1 and i need to create a document from an oracle stored procedure that have only one IN parameter and ten OUT parameters.
Creating the new report I selected the database connection then I choose the stored procedure name from the list, I inserted the value for the IN parameter and finally I click on Run button.
I got the following error message:
ORA-06550: line 1, column 38: :PLS-00103: Encountered the symbol
"," when expecting one of the following: : : ( - + case mod
new not null others <an identifier> : <a double-quoted
delimited-identifier> <a bind variable> avg : count current
exists max min prior sql stddev sum variance : execute forall
merge time timestamp interval date : <a string literal with
character set specification> : <a number> <a single-quoted SQL
string> pipe : <an alternatively-quoted string literal with
character set specification> : <an alternatively-q :-6550
it seems to be caused by the OUT parameters!
i leaved them without any value.
it's the first time that I used a stored procedure to create a BO report, but I think the OUT parameters are needed to do that, otherwise what data will be presented in the report???
can you help me?
please answear me ASAP.
Thank's in advance
Regards
AndreaPost Author: synapsevampire
CA Forum: Publishing
Try posting in a BO forum, this is Crystal Reports.
-k -
Hi,
i havea requirement where in i should be able to call my shell script through oracle stored procedure.i tried the following way..but iam unable to get the result.please find the details below.
new.sh - my shell script - lctfile (LCTFILE) is the input pa
v_config_file=`find $FND_TOP -name LCTFILE
FNDLOAD apps/s0ccer@$dxbs1 0 Y DOWNLOAD $v_config_file /home/bir4163/RPT33/bin/menu.ldt MENU MENU_NAME='AR_NAVIGATE_GUI'
if [ $? != 0 ];then
echo "$DATE $0 FNDLOAD DOWNLOAD Failed!" | tee -a $LOG_FILE
else
echo "SUCCESS" | tee -a $LOG_FILE
fi
CREATE OR REPLACE PROCEDURE test_dbms_scheduler
AS
v_text VARCHAR2 (255) := 'AR_NAVIGATE_GUI';
BEGIN
DBMS_OUTPUT.put_line ('I am in Procedure');
DBMS_SCHEDULER.create_job (
job_name => 'test_dbms_scheduler',
job_action => '/home/bir4163/RPT33/bin/new.sh',
number_of_arguments => 1,
job_type => 'executable',
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled => FALSE,
auto_drop => FALSE,
comments => 'run shell script'
DBMS_SCHEDULER.set_job_argument_value (job_name => 'test_dbms_scheduler',
argument_position => 1,
argument_value => v_text);
DBMS_SCHEDULER.enable ('test_dbms_scheduler');
DBMS_OUTPUT.put_line ('I am back in Procedure');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
END;
But iam unable to test it as i do not have permissions to access dbms_scheduler.can anybody tell me how to solve this using DBMS_PIPE with a sample code.
please do help its very urgent
thanks
ramyaHi,
Register your Shell Script as a concurrent program, Executable execution method "Host", then use fnd_request.submit_request to submit the program.
Regards,
Andries -
Calling a Oracle stored procedure in orchestrator
I am trying to execute a stored procedure using the query database IP in orchestrator. I can select data from the oracle db so i know the prereqs are setup correctly but it fails on executing the stored procedure.
The syntaxe is execute SPNAME('PARAM!','PARAM2')
The error is
Failed, Oracle failure Database error has occurred. ORA-00900: invalid SQL statement
Oracle query failure, please verify your query syntax is correct. Verify correct table names and column names etc...
The SP works fine in sql developer so im pretty sure the syntax is correct unless the Query Database IP needs a different syntax to work.simple as that. i actually tried something similar since that is how SCOM executes SP but left the execute command in there so it failed and i moved on. thanks for the reply.
Just for reference i went the powershell route and that worked as well but much more complicated then your solution. for anyone that wants to know the script is
$asm = [System.Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient")
$connectionString = "Data Source=TNSNAME;uid=USERID;pwd=PASSWORD";
$inputString1 = "PARAMETER INPUT 1";
$inputString2 = "PARAMETER INPUT 2"
$oracleConnection = new-object System.Data.OracleClient.OracleConnection($connectionString);
$cmd = new-object System.Data.OracleClient.OracleCommand;
$cmd.Connection = $oracleConnection;
$cmd.CommandText = "SP NAME";
$cmd.CommandType = [System.Data.CommandType]::StoredProcedure;
$cmd.Parameters.Add("NAME OF EXPECTED PARAMETER 1", [System.Data.OracleClient.OracleType]::NUMBER) | out-null;
$cmd.Parameters["NAME OF EXPECTED PARAMETER 1"].Direction = [System.Data.ParameterDirection]::Input;
$cmd.Parameters["NAME OF EXPECTED PARAMETER 1"].Value = $inputString1;
$cmd.Parameters.Add("NAME OF EXPECTED PARAMETER 2", [System.Data.OracleClient.OracleType]::VARCHAR2) | out-null;
$cmd.Parameters["NAME OF EXPECTED PARAMETER 2"].Direction = [System.Data.ParameterDirection]::Input;
$cmd.Parameters["NAME OF EXPECTED PARAMETER 2"].Value = $inputString2;
$oracleConnection.Open();
$cmd.ExecuteNonQuery() | out-null;
$oracleConnection.Close();
got help from http://dovetailsoftware.com/clarify/gsherman/2012/05/15/calling-oracle-stored-procedures-using-powershell/ -
Invoking ORACLE Stored Procedure
Hello guys,
I have an ORACLE stored procedure which I need to invoke. I'm currently unable to invoke the stored procedure since I'm always getting the same error:
com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'test.set_pickup' (structure 'STATEMENTNAME'): java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SET_PICKUP' ORA-06550: line 1, column 7: PL/SQL: Statement
I've faced several projects where we needed to invoke stored procedures but these were located in a DB2 or Microsoft SQL Server, and these problems never occured.
The procedure is set to the minimum, and is now only with one input parameter. I had an input and output parameter but for narrowing the problem I've removed the output.
The structure for the stored procedure is the one that is referred by SAP or mentioned thousand of times in this forum:
Statement_name
StoredProcedureName (attribute ACTION)
TABLE
P_TRANSACTION_ID (Attributes isInput, isOutput, type)
For the basics I'm only filling with one statement.
I've read some threads with a similar problem but with no response, or solved but with no suggestion on how they solved it.
Could you please help out?
Kind regards,
Gonçalo Mouro VazHi,
Is the structure in Oracle side is of the following format?
<StatementName>
<storedProcedureName action=u201D EXECUTEu201D>
<table>realStoredProcedureeName</table>
<param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
</storedProcedureName >
</StatementName>
Can you paste the structure here?
Regards
Suraj -
Oracle Stored Procedure with out parameter
Good morning,
Is it possible to use an Oracle stored procedure with out parameters in MII ?
If yes, what is the manipulation to see the values of parameters Out?
Thank youMichael,
This is the MII query template :
DECLARE
STRCOMPTERENDU NVARCHAR2(200);
BEGIN
STRCOMPTERENDU := NULL;
XMII.SP_VALIDATEPROCESSORDERSLIST2 ( STRCOMPTERENDU => [Param.1] );
COMMIT;
END;
and the stocked procedure code
CREATE OR REPLACE PROCEDURE XMII.SP_ValidateProcessOrdersList2(strCompteRendu OUT nVarchar2) IS
tmpVar NUMBER;
debugmode INT;
strClauseSql varchar(2048);
strListPOactif varchar(1024);
dtmTimeStamp DATE;
NAME: SP_ValidateProcessOrdersList
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 18/06/2008 1. Created this procedure.
NOTES:
Automatically available Auto Replace Keywords:
Object Name: SP_ValidateProcessOrdersList
Sysdate: 18/06/2008
Date and Time: 18/06/2008, 18:45:32, and 18/06/2008 18:45:32
Username: (set in TOAD Options, Procedure Editor)
Table Name: (set in the "New PL/SQL Object" dialog)
BEGIN
tmpVar := 0;
debugmode := 0;
-- lecture date systeme pour time stamp
select sysdate into dtmTimeStamp from dual;
if debugmode = 1 then
DBMS_OUTPUT.put_line('SP_ValidateProcessOrdersList');
end if;
-- insertion du bloc dans le log
insert into LOG_ORDER
(DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
values
(dtmTimeStamp,'SP_ValidateProcessOrdersList',ID_LOG_ORDER.nextval);
Commit;
if debugmode = 1 then
DBMS_OUTPUT.put_line('insertion LOG OK');
end if;
strCompteRendu := '0123456-896;0123456-897';
commit;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
ROLLBACK;
-- insertion du bloc dans le log
insert into LOG_ORDER
(DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
values
(dtmTimeStamp,' ',ID_LOG_ORDER.nextval);
COMMIT;
-- Consider logging the error and then re-raise
RAISE;
END SP_ValidateProcessOrdersList2;
Thanks for your help
Alexandre -
Calling Oracle Stored procedure with OUT parameter from ODI
Hi,
I called an oracle stored procedure with following anonymous block in the ODI procedure.
Declare
Status varchar2(10);
Begin
OTM.DeleteTarget('E_KPI_TARGET_VALUE', Status);
End;
I want to capture the OUT parameter STATUS value in a project level variable.
And based on its va;lue I would like to choose between 2 interfaces in my package.
Please help me in doing this.Hi,
For that kind of situation I commoly use:
1) one step with:
create or replace package <%=odiRef.getSchemaName("W")%>.pck_var
Status varchar2(10);
end;
* transaction 9, for instance
2) step
Begin
OTM.DeleteTarget('E_KPI_TARGET_VALUE', <%=odiRef.getSchemaName("W")%>.pck_var.Status);
End;
* transaction 9
3) then, at an ODI variable, use a refresh like:
select <%=odiRef.getSchemaName("W")%>.pck_var.Status from dual
at same logical shema where the package was created.
Does it make sense to you? -
Call to Oracle stored procedure that returns ref cursor doesn't work
I'm trying to use an OData service operation with Entity Framework to call an Oracle stored procedure that takes an number as an input parameter and returns a ref cursor. The client is javascript so I'm using the rest console to test my endpoints. I have been able to successful call a regular Oracle stored procedure that takes a number parameter but doesn't return anything so I think I have the different component interactions correct. When I try calling the proc that has an ref cursor for the output I get the following an error "Invalid number or type of parameters". Here are my specifics:
App.config
<oracle.dataaccess.client>
<settings>
<add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
<add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.0" value="implicitRefCursor metadata='ColumnName=WINDFARM_ID;BaseColumnName=WINDFARM_ID;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Number;ProviderType=Int32'" />
<add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.1" value="implicitRefCursor metadata='ColumnName=STARTTIME;BaseColumnName=STARTTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
<add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.2" value="implicitRefCursor metadata='ColumnName=ENDTIME;BaseColumnName=ENDTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
<add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.3" value="implicitRefCursor metadata='ColumnName=TURBINE_NUMBER;BaseColumnName=TURBINE_NUMBER;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
<add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.4" value="implicitRefCursor metadata='ColumnName=NOTES;BaseColumnName=NOTES;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
<add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.5" value="implicitRefCursor metadata='ColumnName=TECHNICIAN_NAME;BaseColumnName=TECHNICIAN_NAME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
<add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
</settings>
OData Service Operation:
public class OracleODataService : DataService<OracleEntities>
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
config.SetEntitySetAccessRule("*", EntitySetRights.All);
config.SetServiceOperationAccessRule("GetWorkOrdersByWindfarmId", ServiceOperationRights.All);
config.SetServiceOperationAccessRule("CreateWorkOrder", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
[WebGet]
public IQueryable<GetWorkOrdersByWindfarmId_Result> GetWorkOrdersByWindfarmId(int WindfarmId)
return this.CurrentDataSource.GetWorkOrdersByWindfarmId(WindfarmId).AsQueryable();
[WebGet]
public void CreateWorkOrder(int WindfarmId)
this.CurrentDataSource.CreateWorkOrder(WindfarmId);
Here is the stored procedure:
procedure GetWorkOrdersByWindFarmId(WINDFARMID IN NUMBER,
P_RESULTS OUT REF_CUR) is
begin
OPEN P_RESULTS FOR
select WINDFARM_ID,
STARTTIME,
ENDTIME,
TURBINE_NUMBER,
NOTES,
TECHNICIAN_NAME
from WORKORDERS
where WINDFARM_ID = WINDFARMID;
end GetWorkOrdersByWindFarmId;
I defined a function import for the stored procedure using the directions I found online by creating a new complex type. I don't know if I should be defining the input parameter, WindfarmId, in my app.config? If I should what would that format look like? I also don't know if I'm invoking the stored procedure correctly in my service operation? I'm testing everything through the rest console because the client consuming this information is written in javascript and expecting a json format. Any help is appreciated!
Edited by: 1001323 on Apr 20, 2013 8:04 AM
Edited by: jennyh on Apr 22, 2013 9:00 AMMaking the change you suggested still resulted in the same Oracle.DataAccess.Client.OracleException {"ORA-06550: line 1, column 8:\nPLS-00306: wrong number or types of arguments in call to 'GETWORKORDERSBYWINDFARMID'\nORA-06550: line 1, column 8:\nPL/SQL: Statement ignored"} System.Exception {Oracle.DataAccess.Client.OracleException}
I keep thinking it has to do with my oracle.dataaccess.client settings in App.Config because I don't actually put the WindfarmId and an input parameter. I tried a few different ways to do this but can't find the correct format. -
Invoking Oracle stored procedures from within a JDBC channel for PI 7.1
Hi ,
Can anybody tell me that is it possible to invoke Oracle stored Procedure from within a JDBC sender channel for PI 7.1.
Its working in XI3.0 and XI 7.0 for Oracle DBMS versions >= 10.2.x. But I am not sure,whether it will work for PI 7.1 also.
Thanks & Regards,
SaruHI,
refer below link,there is no much difference in PI7.1 ,executing stored procedure is same .
http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/7b72b2fde93673e10000000a114a6b/content.htm
Regards,
Raj -
Executing an Oracle Stored Procedure from Sender JDBC adapter
I could really use some help from someone who had done this before.
I've read the help about using the JDBC sender adapter, but it's not helping enough.
I found this line: "Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs."
That's definately what we want to do, but we can't figure out the syntax.
The procedure in oracle looks like this:
CREATE OR REPLACE PROCEDURE test_ref_cursor
( cur_generic IN OUT result_sets.cur_generic)
as
BEGIN
Open cur_generic for
select
proposal_number,
to_char(sequence_number),
column_name,
column_value,
update_timestamp,
update_user
from
coeus.sap_test;
END test_ref_cursor;
And we have tried every kind of statement we can think of, but the file adapter always gives us an "invalid sql statement" error.
Does anyone know what syntax we need to put in the "Query SQL Statement" in the JDBC sender adapter in order to call this procedure? Or is there something wrong with the procedure that is causing the error?
<i>I will absolutely return and give points, but PLEASE read my whole post before answering and do not just link me to or quote the help for configuring a sender JDBC adapter or blogs that are about the JDBC adapter in general but do not deal with the issues I am having. Thank you.</i>Hi Vanda,
Unfortunately, the sender JDBC adapter does not support Oracle's store procedure/function. Unlike stored procedures from other database vendors, Oracle returns a cursor, not a resultset. The sender JDBC adapter must send a resultset to XI.
There are 2 possible ways you can accomplish this:
1. Use BPM and call the Oracle stored procedure using a receiver adapter via a asynch-synch bridge.
2. Develop a user-module for the adapter, which can be used with a sender adapter.
Thanks
Prasad
Maybe you are looking for
-
FRM-92101 Error when trying to access forms in R12 in windows 2003 SP1
Hi, We have installed the Oracle Applications system on one of our instance. When we try to start the application we face some problem: The syndrome is the following: We are launching one of the Apps Forms Page However, we have to wait around 8-10 mi
-
Hi Members, I have an combo box in a user designed screen. I have to list the sales order number for an chosen customer in the combo box. My problem is that all the values are not listing for that customer. Sample coding is as follows: strSQL = "sele
-
Tax details not appearing in the purchase order
Dear Gurus, Am using tax procedure TAXINN. and i have maintained the respective values for the condition type even though while creating purchase order am trying to click the TAXES button but its not simulating the values that pop up ta
-
Why does my iPhoto faces confirmation not work?
Hey guys, I've been having trouble with confirming my iPhoto faces using the Faces feature. When viewing the corkboard in iPhoto '11, I double-click on a face to see more photos of that person. At the bottom, it shows there are 14 unconfirmed faces,
-
Hello I hava an application with a while loop. Outside this loop there is a subVI, that contains also a while loop. This subVI can be stoped when the main VI loop stops. This works correctly. But the subvi, can also stop itself, and when it happens I