Passing parameters to oracle stored procedure in business objects universe
Hello,
Wanted to create a web intelligence usind oracle stored procedure.
Create the following SP
create or replace procedure proc_name1
proc_freq in number,
proc_cur1 in out sys_refcursor
as
begin
INSERT INTO
cc VALUES
( 'Frequency Value = ' || proc_freq, SYSDATE) ;
COMMIT ;
--daily
if(proc_freq = 2) then
open proc_cur1 for SELECT
EVENT_DATE
FROM rqm_mapsigng_dly_stats;
end if;
end;
tried using the above SP in universe, it is needed to pass the parameter for proc_freq, when i pass value 2 , in oracle it is passed as 0(is being traced in rqm_checkpoint table)
Hence the table cannot be inserted in the universe.
Can anyone tell why the value is not being passed correctly
I believe when you're doing it with an insert, you're saying "execute this insert statement a bunch of times, here's all the values in advance", which is different than passing an array to a stored procedure where you want it to execute once.
Oracle's ODBC driver doesnt support Associative Arrays (aka index-by tables).
Hope it helps,
Greg
Similar Messages
-
Passing data from Oracle stored procedures to Java
We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
We're considering one of the 2 following scenarios:
passing objects and lists of objects (DB object types defined on the schema level)
passing a sys_refcursor
We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
I'd appreciate any hints.user1754151 wrote:
We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
We're considering one of the 2 following scenarios:
passing objects and lists of objects (DB object types defined on the schema level)
passing a sys_refcursor
We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
I'd appreciate any hints.If logic is already written in DB, and the only concern is of passing the result to java service side, and also from point of maintenance problem and flexibility i would suggest to use the sys_refcursor.
The reason if Down the line any thing changes then you only need to change the arguments of sys_refcursor in DB and as well as java side, and it is much easier and less efforts compare to using and changes required for Types and Objects on DB and java side.
The design and best practise keeps changing based on our requirement and exisiting design. But by looking at your current senario and design, i personally suggest to go with sys_refcursor. -
Passing arrays to Oracle Stored procedure.
Have any body passed arrays to Oracle stored procedures while the app is running in Weblogic app server. I am able to pass the arrays with regular JDBC connection. If I run the same piece of code using a connection recieved from the datasource of weblogic server, its not working. I am getting serialization errors with the ArrayDescriptor class. Looks like the ArrayDescriptor is not serializable.
Does anybody know solution/workaround to pass arrays ?
Thanks in advanceyou could write a wrapper class that extends ArrayDescriptor and implements serializable...
for example your class would look something like this.
public class MyArrayDescriptor extends ArrayDescriptor
implements Serializable
in your regular code use the wrapper class in place of the ArrayDescriptor (it will contain all the same methods as the real ArrayDescriptor) and you should be able to toss your wrapper class anywhere you please. -
Passing DATE parameters to Oracle Stored Procedures using ADO
Does anyone know how can I pass a date parameter to an Oracle
Stored Procedure? The IN parameter of the procedure is of type
DATE and the ADO parameter is of type DBDate (I've tried Date
and DBTimeStamp,too). The execution freezes at "Cmd.Execute".
Can anyone suggest a solution?
Thanx for any tipsAs far as I know the documentation on CR & stored procedures says that the REF CURSOR has to be a strongly bound one.
Could you go into a little more detail? Do you mean I should put a multi-valued parameter into a REF CURSOR? Can you post some code snippets here? -
Pass xmltype to oracle stored procedure
I need to pass an xmltype from java to an oracle stored procedure. Does anybody have any sample code to do this? I am using jdeveloper 10.1.2
Thanks
MMOracle provides several ways of passing objects to and from java to Oracle Stored Procedure.
One way is to directly create oracle.sql.STRUCT object and pass array of values to this object. Another way is to implement java.sql.SQLData or oracle.sql.ORAData interfaces in your class and pass this class to setObject function.
It is all well described in manual in chapter "Working with Oracle Object Types", there is also a lot of examples in this chapter and on the web.
http://download-uk.oracle.com/docs/cd/B19306_01/java.102/b14355/oraoot.htm - Working with Oracle Object Types
Some of the examples:
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/ObjectOracleSample/Readme.html
http://javaalmanac.com/egs/java.sql/InsertObjectOraclePreparedStatement.html -
Passing array to Oracle stored procedure
Is it possible to pass an array (TYPES.Array) to an oracle stored procedure in WLI? I know it can be done in vanilla jdbc.
I have tried to do this but I'm getting this exception:
java.sql.SQLException: Fail to convert to internal representation:Well well well......I was able to fix the same.
The implementation for writeSQL is the catch. We need to give the conversion only in that.
Anyway, thanks. -
Physical service to invoke Oracle stored procedure taking an object type
Hello,
I have some stored procedures in Oracle that take a complex object type as parameters. Can I invoke these directly from ODSI? If so, how do I create the physical service for this?
Example:
CREATE OR REPLACE TYPE "CCSUSERDV"."TEST_TYPE" as object (
name varchar2(80),
text varchar2(1000),
some_other number
CREATE OR REPLACE PACKAGE CCSUSERDV.TEST
as
function joinText(inVal in TEST_TYPE) return varchar2;
end;
CREATE OR REPLACE PACKAGE BODY CCSUSERDV.TEST
AS
FUNCTION joinText(inVal in TEST_TYPE) return varchar2 AS
BEGIN
if (inVal.text is not null) then
return inVal.name || '-' || inVal.text;
else
return inVal.name || ':' || inVal.some_other;
end if;
END;
END;
I Want to be able to call TEST.joinText from OSDI. I know I could create a separate function that takes all the attributes of my object, but it would be considerably more convenient to implement in terms of the object instead, because there are several functions that take the same set of about 20 fields as a request.
Thank you!!
Jeff(1) Your best bet is to create a wrapper stored procedure that takes simple arguments and constructs the object, then calls your stored procedure with the object. You call the wrapper stored procedure from ODSI. JPublisher can create wrapper stored procedures for you.
(2) If it is impossible for you to create a wrapper stored procedure in the database, you can create a physical data service from the existing stored procedure. You will notice that the function in the physical data service will have simple arguments (not the object), and if you try to execute it, it will fail. It's up to you to write an anonymous pl/sql block that wraps the existing stored procedure (basically what you would have had to write for (1)), and edit the metadata in the physical ds - where it has the name of the stored procedure, replace the name with your anonymous PL/SQL block.
Below is what the CREATE_BATCH stored procedure from Oracle Process Manufacturing would look like. (it also has CURSOR args - so it is uglier than just Objects). It also demonstrates that you need to do a conversion of boolean args.
xquery version "1.0" encoding "WINDOWS-1252";
(::pragma xds <x:xds xmlns:x="urn:annotations.ld.bea.com" targetType="t:CERTIFY_BATCH" xmlns:t="ld:JdbcTest4DataServices/opm/CERTIFY_BATCH">
<creationDate>2007-01-14T20:55:37</creationDate>
<relationalDB dbVersion="10" dbType="oracle" name="oracleXeDataSource"/>
</x:xds>::)
declare namespace f1 = "ld:JdbcTest4DataServices/opm/CERTIFY_BATCH";
import schema namespace t1 = "ld:JdbcTest4DataServices/opm/CERTIFY_BATCH" at "ld:JdbcTest4DataServices/opm/schemas/CERTIFY_BATCH.xsd";
(::pragma function <f:function xmlns:f="urn:annotations.ld.bea.com" kind="read" nativeName="DECLARE p_batch_header gme_batch_header%rowtype; x_batch_header gme_batch_header%rowtype; x_unallocated_material gme_api_pub.unallocated_materials_tab; TYPE rc IS REF CURSOR; PROCEDURE to_ref_cursor(x IN gme_api_pub.unallocated_materials_tab, ref_cursor IN OUT rc) IS l_data bea_unallocated_materials_tab := bea_unallocated_materials_tab(); BEGIN FOR i IN x.FIRST .. x.LAST LOOP l_data.EXTEND; l_data(i) := bea_unallocated_materials_type(x(i).batch_id, x(i).batch_no, x(i).material_detail_id, x(i).line_type, x(i).line_no, x(i).item_id, x(i).item_no, x(i).alloc_qty, x(i).unalloc_qty, x(i).alloc_uom); END LOOP; OPEN ref_cursor FOR SELECT * FROM TABLE ( CAST (l_data AS bea_unallocated_materials_tab) ); END; FUNCTION to_boolean(n IN NUMBER) RETURN BOOLEAN IS BEGIN IF (n = 0) THEN RETURN FALSE; ELSE RETURN TRUE; END IF; END to_boolean;BEGIN p_batch_header.batch_id := ?; p_batch_header.batch_no := ?; p_batch_header.plant_code := ?; p_batch_header.batch_type := ?; p_batch_header.actual_start_date := ?; p_batch_header.actual_cmplt_date := ?; gme_api_pub.certify_batch( p_api_version => ?, p_validation_level => ?, p_init_msg_list => to_boolean(?), p_commit => to_boolean(?), x_message_count => ?, x_message_list => ?, x_return_status => ?, p_del_incomplete_manual => to_boolean(?), p_ignore_shortages => to_boolean(?), p_batch_header => p_batch_header, x_batch_header => x_batch_header, x_unallocated_material => x_unallocated_material ); ? := x_batch_header.batch_id; ? := x_batch_header.batch_no; ? := x_batch_header.plant_code; ? := x_batch_header.batch_type; ? := x_batch_header.actual_start_date; ? := x_batch_header.actual_cmplt_date; ? := x_batch_header.plan_start_date; ? := x_batch_header.plan_cmplt_date; ? := x_batch_header.due_date; ? := x_batch_header.recipe_validity_rule_id; ? := x_batch_header.wip_whse_code; to_ref_cursor(x_unallocated_material, ?);END;" nativeLevel2Container="" nativeLevel3Container="" style="storedProcedure">
<params xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes" xmlns:pn1="ld:JdbcTest4DataServices/opm/CERTIFY_BATCH" >
<param name="BATCH_ID" kind="in" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
<param name="BATCH_NO" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="PLANT_CODE" kind="in" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
<param name="BATCH_TYPE" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="ACTUAL_START_DATE" kind="in" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
<param name="ACTUAL_CMPLT_DATE" kind="in" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
<param name="P_API_VERSION" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="P_VALIDATION_LEVEL" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="P_INIT_MSG_LIST" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="P_COMMIT" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="X_MESSAGE_COUNT" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="X_MESSAGE_LIST" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
<param name="X_RETURN_STATUS" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
<param name="P_DEL_INCOMPLETE_MANUAL" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="P_IGNORE_SHORTAGES" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="BATCH_ID" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
<param name="BATCH_NO" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="PLANT_CODE" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
<param name="BATCH_TYPE" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
<param name="ACTUAL_START_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
<param name="ACTUAL_CMPLT_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
<param name="PLAN_START_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
<param name="PLAN_CMPLT_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
<param name="DUE_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
<param name="RECIPE_VALIDITY_RULE_ID" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
<param name="WIP_WHSE_CODE" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
<param name="X_UNALLOCATED_MATERIAL" kind="out" xqueryType="pn1:X_UNALLOCATED_MATERIAL_ROW" nativeTypeCode="-10" nativeType="REF CURSOR"/>
</params>
</f:function>::)
declare function f1:CERTIFY_BATCH($p_batch_header_batch_id as xsd:string, $p_batch_header_batch_no as xsd:decimal, $p_batch_header_plant_code as xsd:string, $p_batch_header_batch_type as xsd:decimal, $p_batch_header_actual_start_date as xsd:dateTime, $p_batch_header_actual_cmplt_date as xsd:dateTime, $p_api_version as xsd:decimal, $p_validation_level as xsd:decimal, $p_init_msg_list as xsd:integer, $p_commit as xsd:integer, $p_del_incomplete_manual as xsd:integer, $p_ignore_shortages as xsd:integer) as schema-element(t1:CERTIFY_BATCH) external; -
Passing array to oracle stored procedure in VC++ 2005
Hi,
I am try to send an array of integers to a stored procedure via ODBC 10.2.0.3 on VC++2005 enviornment. I get the below error
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'MYPROC1'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored ... Error Code = 6550
[]E R R O R
The same code works if I use an INSERT statement.
SQLUSMALLINT* rowsProcessed = new SQLUSMALLINT;
RETCODE nRetCode;
const int arraySize = 200;
long ptrVal[arraySize];
long ptrInd[arraySize];
long ptrStatus[arraySize];
for (int i = 0; i < arraySize; i++)
ptrVal = i;
ptrInd = 0;
nRetCode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_PARAM_BIND_TYPE, SQL_PARAM_BIND_BY_COLUMN, 0);
// assign the number of sets of parameters that are to be inserted
nRetCode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER)iSizeOfArray, 0);
// assign an array to retrieve status info for each row of parameter values
nRetCode =SQLSetStmtAttr(m_hstmt, SQL_ATTR_PARAM_STATUS_PTR, (SQLPOINTER)ptrStatus, 0);
// assign a buffer to store the number of sets of parameters that have been processed
nRetCode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_PARAMS_PROCESSED_PTR, (SQLPOINTER)rowsProcessed, 0);
nRetCode = SQLBindParameter(m_hstmt, nParamIndex, nDirection, SQL_C_LONG, SQL_INTEGER, 0, 0, ptrVal, 0, ptrInd);
//suceeds
SQLPrepare(m_hstmt, (SQLCHAR*)"INSERT INTO my_table VALUES (?)", SQL_NTS);
//fails
SQLPrepare(m_hstmt, (SQLCHAR*)"{CALL mypackage.myproc1(?)}", SQL_NTS);
SQLExecute(m_hstmt);
package is
create or replace package mypackage
as
type mytable is table of binary_integer;
procedure myproc1( l_tab in mytable);
end;
show errors
create or replace package body mypackage
as
procedure myproc1( l_tab in mytable)
as
begin
insert into my_table values (100);
commit;
FORALL i IN l_tab.first .. l_tab.last
INSERT into my_table values( l_tab(i) );
end;
end;
any ideas?I believe when you're doing it with an insert, you're saying "execute this insert statement a bunch of times, here's all the values in advance", which is different than passing an array to a stored procedure where you want it to execute once.
Oracle's ODBC driver doesnt support Associative Arrays (aka index-by tables).
Hope it helps,
Greg -
Pass array to oracle stored procedure
I have such a problem: I have to pass array to stored procedure, so I declare type:
create type tNumberArray as table of number
and create procedure:
create or replace procedure proc_1 (in_param in tNumberArray) as
.... BODY OF PROCEDURE ...
when I call this procedure from C# like this:
int []pParam = new int[3] {1,2,3};
OracleCommand cmd = new OracleCommand("proc_1", dbConn);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter param14 = new OracleParameter("param", OracleDbType.Decimal);
param14.Value = pParam;
param14.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
param14.Size = 3;
param14.Direction = ParameterDirection.Input;
cmd.Parameters.Add(param14);
cmd.ExecuteNonQuery();
an error occures. It say that there invalid number or type of parameters.
But when I declare both type and procedure in a package everything goes fine.
What is the matter? Did anybody have the same problem?Not I got next problem:
when I cannot pass parameter to stored procedure and get array fro it. In other words returning array from procedure and passing some input parameters to it does not word!
Does anybody know why it happens? -
Multi-Value Parameters to Oracle Stored Procedures via SQL Commands
Hi,
When you used stored procedure in CR, you need to declare REF CURSOR, This type of cursor is a dynamic cursor not a static cursor. Hence, you are able to manipulate dataset in this type of cursor.
Regards,
Titanium0203As far as I know the documentation on CR & stored procedures says that the REF CURSOR has to be a strongly bound one.
Could you go into a little more detail? Do you mean I should put a multi-valued parameter into a REF CURSOR? Can you post some code snippets here? -
How to pass values to Oracle store procedure in Crystal Report
Hi all,
I am newbie on passing values to stored procedure parameters. I created a Crystal Report using the Crystal Report wiward with PULL method and data come from Oracle stored procedure. In an ASP.NET page, I have stored two values in Session and need to pass them as input parameters to Oracle stored procedure to print the report. In Crystal reports 2010 once you connect to a stored-procedure as data source, it automatically creates the parameter fields with Crytal Report Viewer. Please show me how I pass values to store procedure at runtime automatically.
'Set the parametter value
myReport.SetParameterValue("@P_COURSE", "CoursetNo")
myReport.SetParameterValue("@P_CLASS", "ClassNo")
End Sub
I tried to apply above codes from Brian Bischof book but display the error from the following lines:
myReport.SetParameterValue("@P_COURSE", "CoursetNo")
myReport.SetParameterValue("@P_CLASS", "ClassNo")
I also enclosed my code. Any experts, please let me know anything wrongs on my code . I tried several methods that searching via google, but did not solve my issues. Thanks.
Edited by: avt2K7 on Mar 15, 2011 7:02 AMHi,
Thank you for your response. Here are the detailed code and error as following:
Please show what I am missing in my below VB.NET codes:
===========================================================================================
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
LogonToTables("username", "password", "servername", "")
End Sub
Private Sub LogonToTables(ByVal myUserId As String, ByVal myPassword As String, ByVal myServerName As String, ByVal myDataBaseName As String)
Dim Course, Class As String
Course = Session.Item("CourseNumber"))
Class = Session.Item("ClassNumber"))
Dim myReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
myReport.Load(Server.MapPath("CrystalReport1.rpt"))
Dim myTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
'Set the database properties and security credentials
Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
myConnectionInfo.ServerName = "servername"
myConnectionInfo.DatabaseName = ""
myConnectionInfo.UserID = "username"
myConnectionInfo.Password = "password"
'Apply the ConnectionInfo to the report tables
Dim myTables = myReport.Database.Tables
For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
myTableLogonInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
'Set the parametter value to Crystal Report parameter named P_COURSE and P_CLASS
myReport.SetParameterValue("@P_COURSE", "Course")
myReport.SetParameterValue("@P_CLASS", "Class")
End Sub
=================================================================================
I put a break point to debug but display the error at the following lines:
myReport.SetParameterValue("@P_COURSE", "Course")
myReport.SetParameterValue("@P_CLASS", "Class")
Eventhough, if I set a specific value to Course=1000 and Class = math and still receive the error:
Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
I tried several sources from Google search but it is not working. I really appreciate any detailed code either in C# or VB.NET to solve my issues. Thanks in advance. -
How to Pass parameters to Crystal report 10 based on Oracle Stored Procedur
Hi,
I use the following code to pass the parameters:
Rep.Tables[0].ConnectBuffer := Connection_Str;
Rep.Tables[0].AliasName := 'REP';
Rep.Connect.Propagate := True;
Rep.ParamFields.ByName('Lang', '').CurrentValue := IIF(BiDiMode = bdRightToLeft, '2', '1');
Rep.ParamFields.ByName('SESSION_ID', '').CurrentValue := IntToStr(Session_id);
Rep.WindowState := wsMaximized;
Rep.Show;
The 1st parameter 'Lang' which created from crystal report pass well,
but the 2nd parameter 'SESSION_ID' which created from Oracle Stored Procedures give the following Error:
Error: 202 Parameter Name could not be found u2013 ParamFields.ByName
However in MS SQL Server the above code work fine with the 2 Parameters.
Any one has solution,Hello,
Click on the businessobjects Tab above and then select Samples and dowload the sample app you for your SDK. There are a few samples for changing/setting Parameters.
The Parameter collection has all parameters.
Thank you
Don -
Reporting off oracle stored procedure with parameters error
Erorr message: Error in File xxx.rpt: Failed to retrieve data from the database. Details: [Database Vendor Code: 907 ]
Asp.net 2.0 web application.
CR XI R2 sp2 in BOE XI R2 sp2 on Solaris 10.
Database: Oracle 10g on Solaris 10. Oracle stored procedure defined in package.
Happens with reports reporting off stored procedure with parameters.
The sp is used in the crystal report.
The web application passes parameters to crystal report, which then passes the parameters to stored procedure.
Encountered error if:
r.PromptOnDemandViewing = false;
r.UseOriginalDataSource = false;
r.CustomServerType = CeReportServerType.ceServerTypeOracle;
Report can retrieves data if:
r.PromptOnDemandViewing = false;
r.UseOriginalDataSource = true;
r.CustomServerType = CeReportServerType.ceServerTypeOracle;
In addition
The steps are:
1) Create oracle package and stored proc.
2) In CR Designer, select the stored proc as datasource.
3) The parameters names were "generated" by the CR Designer.
4) Rename the parameter names.
5) Drag the fields onto report.
We noticed the following with different setting of database logon info:
When previewing from BOE, get error when "Use custom database logon information specified here"
However, no error when "Use original database logon information from the report".
Am i missing something?Please re-post if this is still an issue to the Data Connectivity - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly
-
Passing Arrays of User Defined Types to Oracle Stored Procedures
Hi
I am using WebLogic 8.14 & Oracle 9i with thin JDBC driver.
Our application needs to perform the same DB operation for every item in a Java Collection. I cannot acheive the required performance using the standard Prepare & Execute loop and so I am looking to push the whole collection to Oracle in a single invocation of a Stored Procedure and then loop on the database.
Summary of Approach:
In the Oracle database, we have defined a Object Type :
CREATE OR REPLACE
TYPE MYTYPE AS OBJECT
TxnId VARCHAR2(40),
Target VARCHAR2(20),
Source VARCHAR2(20),
Param1 VARCHAR2(2048),
Param2 VARCHAR2(2048),
Param3 VARCHAR2(2048),
Param4 VARCHAR2(2048),
Param5 VARCHAR2(2048),
and we have defined a collection of these as:
CREATE OR REPLACE
TYPE MYTYPE_COLLECTION AS VARRAY (100) OF MYTYPE
There is a stored procedure which takes one of these collections as an input parameter and I need to invoke these from within my code.
I am having major problems when I attempt to get the ArrayDescriptor etc to allow me to create an Array to pass to the stored procedure. I think this is because the underlying Oracle connection is wrapped by WebLogic.
Has anyone managed to pass an array to an Oracle Stored procedure on a pooled DB connection?
Thanks
AndyAndy Bowes wrote:
Hi
I am using WebLogic 8.14 & Oracle 9i with thin JDBC driver.
Our application needs to perform the same DB operation for every item in a Java Collection. I cannot acheive the required performance using the standard Prepare & Execute loop and so I am looking to push the whole collection to Oracle in a single invocation of a Stored Procedure and then loop on the database.
Summary of Approach:
In the Oracle database, we have defined a Object Type :
CREATE OR REPLACE
TYPE MYTYPE AS OBJECT
TxnId VARCHAR2(40),
Target VARCHAR2(20),
Source VARCHAR2(20),
Param1 VARCHAR2(2048),
Param2 VARCHAR2(2048),
Param3 VARCHAR2(2048),
Param4 VARCHAR2(2048),
Param5 VARCHAR2(2048),
and we have defined a collection of these as:
CREATE OR REPLACE
TYPE MYTYPE_COLLECTION AS VARRAY (100) OF MYTYPE
There is a stored procedure which takes one of these collections as an input parameter and I need to invoke these from within my code.
I am having major problems when I attempt to get the ArrayDescriptor etc to allow me to create an Array to pass to the stored procedure. I think this is because the underlying Oracle connection is wrapped by WebLogic.
Has anyone managed to pass an array to an Oracle Stored procedure on a pooled DB connection?
Thanks
AndyHi. Here's what I suggest: First please get the JDBC you want to work in a
small standalone program that uses the Oracle thin driver directly. Once
that works, show me the JDBC code, and I will see what translation if
any is needed to make it work with WLS. Will your code be running in
WebLogic, or in an external client talking to WebLogic?
Also, have you tried the executeBatch() methods to see if you can
get the performance you want via batches?
Joe -
PLS-00306:NET to call Oracle stored procedure,Use Array parameters
Development Environment:Windows 2003 SP2+Oracle 10g
. NET to call Oracle stored procedure, use an array of types of parameters
Step1:(In the Oracle database define an array of types)
CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
OR
CREATE OR REPLACE type string_array is table of nvarchar2(255)
Step2:
CREATE OR REPLACE PROCEDURE Test
(i_test in string_varray,o_result out int)
IS
BEGIN
o_result:=i_test.count;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
o_result:=0;
END arraytest;
Step3:
ODP.NET(Oracle 10g)
OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
OracleCommand cmd = new OracleCommand("Test", conn);
cmd.CommandType = CommandType.StoredProcedure;
string[] str = new string[2] { "11", "222" };
cmd.ArrayBindCount=2;
OracleParameter p1 = new OracleParameter("i_test", OracleDbType.NVarChar);
p1.Direction = ParameterDirection.Input;
p1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p1.Value = str;
p1.ArrayBindSize=new int[2]{2,3};
p1.ArrayBindStatus = new OracleParameterStatus[2]{
OracleParameterStatus.Success,
OracleParameterStatus.Success
cmd.Parameters.Add(p1);
OracleParameter p2 = new OracleParameter("o_result", OracleDbType.Int32);
p2.Direction = ParameterDirection.Output;
P2.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p2.Value=0;
cmd.Parameters.Add(p2);
int i = 0;
try
conn.Open();
cmd.ExecuteNonQuery();
i =(int) p2.Value;
catch (Exception ex)
finally
conn.Close();
Error:
Execution Failed:ORA-06550:Line 1,Column 7:
PLS-00306:Test parameters when calling the number or types of errors
ORA-06550:Line 1,Column 7:
PL/SQL:Statement ignoredHi,
See the answer in [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=909564&tstart=0]
Hope it helps,
Greg
Maybe you are looking for
-
How can I connect my iMac to a TV for playback of videos? My TV does not have HDMI.
How can I connect my iMac to a TV for playback of videos? My TV does not have HDMI.
-
I have a Canon Pixma ip 4200. I have had no problems printing with any other application but I cannot get Pages to print. I had the demo version and thought that was the problem, so I bought the application, but I still only get a small part of the p
-
Silver XY Graph Control legend does not scale properly
When a Silver XY Graph Control is dropped on a front panel, and the control is set to "Fit Control to Pane", the graph legend does not move like it is supposed to. This seems to only affect the XY graph. The waveform graph/chart opererate correctly (
-
How can I extend language support in Portal
Hi everybody, We need extend Vietnamese language suport for Oracle Portal. In others portal (open source ), i can do it by config an properties like : locale.., and provider the resources for our language . In Oracle Portal, i don't hearing anything
-
Why is my iphone 6 calendar changing the time zone on my events after I create them?
Every event I create in my calendar has the correct time and time zone on it. After I add it it puts it in my calendar at GMT instead of Chicago.