Calling a Procedure an this return a Cursor......
i have a package with a procedure like this
PACKAGE PKG_TEST IS
TYPE data_cursor IS REF CURSOR;
PROCEDURE PRC_GET_DATA( VAR_ONE IN VARCHAR2, IO_CURSOR OUT data_cursor ) ;
END ;
PACKAGE BODY PKG_TEST IS
PROCEDURE PRC_GET_DATA( VAR_ONE IN VARCHAR2, IO_CURSOR OUT data_cursor ) IS
MENSAJE VARCHAR2(1000);
CURSOR_AUX DATA_CURSOR;
ERR_NUM NUMBER;
ERR_MSG VARCHAR2(100);
BEGIN
OPEN CURSOR_AUX FOR
SELECT ATTRIB1, ATRIB2 FROM TABLE WHERE (CODITION);
IO_CURSOR := CURSOR_AUX;
END PRC_GET_DATA;
END;
and, i have some troubles to call from JSP page...
the java Source is
Connection conn = source.getConnection();
Statment stmt = conn.createStatment();
CallableStatment cs = conn.prepareCall( {CALL PKG_TEST.PRC_GET_DATA( '%') } );
ResultSet rset = cs.executeQuery();
Some can help me?....
You must register the input/output parameters like this and then call stored procedure/function
CallableStatement cstStat = this.con.prepareCall("{? = call some_package.some_function(?) }");
cstStat.registerOutParameter(1, java.sql.Types.VARCHAR);
cstStat.setString(2, Name);
int res = cstStat.executeUpdate();
String outParam = cstStat.getString(1);
Similar Messages
-
Need urgent help - how to call a procedure from sql returning a rowset
Hello,
I need to send a SQL Query from a VB application to let it execute on the oracle DB. This query needs to call a procedure/function, which returns a resultsets, so that i can to a (Where x in ( <call procedure> )). Would result in Where x in (50,100,3094).
Is this possible in oracle, and how?
Thanks.
Daniel MeyerHi Daniel,
I had a similiar problem yesterday.
Thanks to the nice people in this forum I was able to figured that out.
So here is a PL/SQL Oracle 9i code for your reference.
You can create and test it using the SQL Plus console.
I used this stored procedure in my VB .NET and worked fine!
I am enclosing the VB code in this reply as well.
One last note: in order to test it in the VS .NET, don't forget to download the Oracle ODP driver for .NET
Good luck!
Amintas
create or replace package pkg_emp
AS
type rc_emp is ref cursor;
end;
create or replace
procedure SP_GetEmpData(v_empno IN emp.empno%Type,
v_ename IN emp.ename%Type,
emp_cur OUT pkg_emp.rc_emp)
is
begin
if v_empno is not null and v_ename is null then
OPEN emp_cur for
select empno,ename,sal
from emp
where empno=v_empno;
elsif v_ename is not null and v_empno is null then
OPEN emp_cur for
select empno,ename,sal
from emp
where ename like v_ename ||'%';
end if;
end;
/* Testing the stored procedure */
/*#1 */
var myresultset refcursor;
execute SP_GetEmpData(7900,null,:myresultset);
print myresultset;
/*#2 */
var myresultset refcursor;
execute SP_GetEmpData(null,'A',:myresultset);
print myresultset;
-x-x-x-x-x-x-x-x-x VB .NET CODE x-x-x-x-x-x-x-xx-x-
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcurar.Click
Dim dr As Oracle.DataAccess.Client.OracleDataReader
Try
If txtEmpNo.Text <> "" Then
dr = GetData(CInt(Val(txtEmpNo.Text)), "")
Else
dr = GetData(0, UCase(txtEname.Text))
End If
txtEmpNo.Text = ""
txtEname.Text = ""
Catch ex As Exception
Response.Write(ex)
End Try
drgTest.DataSource = dr
drgTest.DataBind()
End Sub
Private Function GetData(ByVal v_empno As Integer, ByVal v_ename As String) As Oracle.DataAccess.Client.OracleDataReader
Dim cn As New Oracle.DataAccess.Client.OracleConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim cmd As New Oracle.DataAccess.Client.OracleCommand
Dim dr As Oracle.DataAccess.Client.OracleDataReader
cmd.Connection = cn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "SP_GetEmpData"
cmd.Parameters.Add("v_empno", Oracle.DataAccess.Client.OracleDbType.Int32).Value = IIf(v_empno = 0, System.DBNull.Value, v_empno)
cmd.Parameters.Add("v_ename", Oracle.DataAccess.Client.OracleDbType.Varchar2, 40).Value = IIf(v_ename = "", System.DBNull.Value, v_ename)
cmd.Parameters.Add("rc_emp", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output
Try
cn.Open()
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Catch ex As Exception
Throw ex
Exit Function
End Try
Return dr
End Function -
SOAP TO JDBC scenario: calling stored procedure which will return the value
Hi
I have Soap To Jdbc scenario in which I am going to call the Stored Procedure at target side which will be executed and it is going to return the result set .
Result contains following values.
return code as ( 0 Or 1) and also specific exception message if its return code as 1.
Could you suggest me the way by which I can handled this return code and send it back to the Sap PI system then the same thing is directed the to SMTP server for sending mail to consern person.
Regards
KumarThe OUT parameters of stored procedure will be returned as response. Where exactly are you facing the proble? Here is a complete walkthourgh
/people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
In your case, you don't want response at sender. Instead you want to mail it. For this you may use BPM to design your scenario with following steps
Receive (to receive data from sender)
Send Sync (to stored procedure and get response)
Send Async (to mail receiver)
Regards,
Prateek -
JDBC SQL Server Channel Calling Stored Procedure Won't Return Result Set
Good afternoon, Experts
We're calling a stored procedure in a sender communcation channel. I can perform any SQL SELECT statement here, but for some reason when I execute the SP (EXECUTE StoredProcedureName) The Adapter Engine returns the following:
Database-level error reported by JDBC driver while executing statement 'DECLARE @UpdateRecords bit SET @UpdateRecords = 0 EXECUTE ExportToSAP @UpdateRecords'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
Even stranger yet is is that this works just fine on our PI-DEV system. I created an identical communication channel connecting to the same database with the same UID and PWD and it won't work in PI-QAS.
Any help/ideas you could share would be greatly appreciated!!!
Thanks,
ChadHi Chad.
Normally, itu2019s a problem with your procedure. The Store Procedure is wrong and something is different between your DEV environment and QAS environment.
Try to ask to DB team check it.
Regards,
Bruno -
How to call a procdure that will return me list of values(JSF,ADF BC)
hi all,
any one can help me how to call a procedure that will return me list of value with using adf and jsfI did this with a LoginModule that returned a list of user roles. Below is the Java call
stmt = conn.prepareCall(authquery);
stmt.registerOutParameter(1, OracleTypes.CURSOR);
stmt.setString(2,username);
stmt.setString(3,new String(password));
// realm is null if not set
stmt.setString(4,_application_realm);
stmt.execute();
rolesResultSet = (ResultSet)stmt.getObject(1);
stmt.close();authquery is the name of a procedure that returned a ref Cursor
CREATE OR REPLACE PACKAGE "DBPROCLM" IS
TYPE principal_ref IS REF CURSOR;
function get_user_authentication(p_username in varchar2, p_password in varchar2, p_realm varchar2) return principal_ref;
END;
CREATE OR REPLACE PACKAGE BODY "DBPROCLM" IS
FUNCTION get_user_authentication (p_username in varchar2, p_password in varchar2, p_realm varchar2)
RETURN principal_ref
AS
var_username varchar2(100);
var_userid number(10);
var_password varchar2(100);
role_cursor principal_ref;
FAILED_AUTHENTICATION exception;
BEGIN
select userid, username, password into var_userid, var_username, var_password from sec_users where username = p_username;
if (var_password = p_password) then
begin
if (p_realm is null) then
open role_cursor for
select rolename from user_roles_view where userid = var_userid;
else
open role_cursor for
select rolename from user_roles_view where userid = var_userid and realm=p_realm;
end if; -- p_realm check
end;
-- if password doesn't match, raise Excpetion for LM to
-- abort the authentication process
else raise FAILED_AUTHENTICATION;
end if;
RETURN role_cursor;
END get_user_authentication;
END;You only ned to expose the call to teh procedure in a method (e.g. on ADF BC Application Module) and create a method binding for it.
Frank -
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. -
Calling a procedure that returns a cursor inside a procedure
Hi,
I have two stored procedures. They both return a cursor as output variables. On the other hand I have another stored procedure that calls these procedures and return their results again an output variable. I know that this seems quite odd to be wanting to do something like this but how can I do that?You can make the hack generic. Make it execute any SQL as that schema that creates the ref cursor. E.g.
// as schema BILLY, open a huge security hole and grant access to USER1
SQL> create or replace procedure GetTableData( tableName varchar2, refCur out sys_refcursor ) authid definer is
2 dynamicSQL varchar2(32767);
3 begin
4 dynamicSQL := 'select * from '||tableName;
5 open refCur for dynamicSQL;
6 end;
7 /
Procedure created.
SQL>
SQL>
SQL> grant execute on GetTableData to USER1;
Grant succeeded.As USER1, you can now execute SQL (and even PL/SQL) as BILLY:
SQL> create or replace type TStrings is table of varchar2(4000);
2 /
Type created.
SQL> grant execute on TStrings to BILLY;
Grant succeeded.
SQL> --// execute this as the caller (which will be BILLY.GetTableData)
SQL> create or replace procedure ExecSQL( hackSQL varchar2 ) authid current_user is
2 pragma autonomous_transaction;
3 begin
4 execute immediate hackSQL;
5 commit;
6 end;
7 /
Procedure created.
SQL> --// wrap the above into something that BILLY.GetData can execute as a ref cursor
SQL> --// and return a meaningful message as to how successful the hack was
SQL> create or replace function PipeLineHack( hackSQL varchar2 ) return TStrings authid current_user pipelined is
2 begin
3 ExecSQL( hackSQL );
4 pipe row( 'SQL hack successful' );
5 exception when OTHERS then
6 pipe row( 'SQL hack faled with '||SQLERRM(SQLCODE) );
7 end;
8 /
Function created.
SQL>
SQL> grant execute on PipeLineHack to BILLY;
Grant succeeded.
SQL>
SQL> var c refcursor
SQL> --// expected used of the GetTableData() interface
SQL> --// we select from table BILLY.EMP
SQL> exec BILLY.GetTableData( 'EMP', :c );
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 1980/12/17 00:00:00 800 0 20
7499 ALLEN SALESMAN 7698 1981/02/20 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 1981/02/22 00:00:00 1250 500 30
7566 JONES MANAGER 7839 1981/04/02 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 1981/09/28 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 1981/05/01 00:00:00 2850 30
7782 CLARK MANAGER 7839 1981/06/09 00:00:00 2450 10
7788 SCOTT ANALYST 7566 1987/04/19 00:00:00 3000 20
7839 KING PRESIDENT 1981/11/17 00:00:00 5000 10
7844 TURNER SALESMAN 7698 1981/09/08 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 1987/05/23 00:00:00 1100 20
7900 JAMES CLERK 7698 1981/12/03 00:00:00 950 30
7902 FORD ANALYST 7566 1981/12/03 00:00:00 3000 20
7934 MILLER CLERK 7782 1982/01/23 00:00:00 1300 10
14 rows selected.
SQL>
SQL> --// getting that interface to run unexpected code - we
SQL> --// rename BILLY.EMP table to something else
SQL> exec BILLY.GetTableData( 'TABLE(USER1.PipeLineHack( ''alter table emp rename to emp_has_been_hacked''))', :c );
PL/SQL procedure successfully completed.
SQL> print c
COLUMN_VALUE
SQL hack successful
SQL> -
Function calling stored procedure that returns a cursor into a LOV
Hello,
Is it possible in HTML DB to implement a process that has a function that calls a stored procedure that returns a cursor, used to then populate a select list?
Or can I do a function call to a stored procedure in the 'List of values definition' box for the item itself that returns a cursor to populate the item's select list?Hi Vikas,
Actually, I just found another posting that shows how to do what I'm looking for:
Re: Filling a LOV with a cursor
Check it out. I posted another question in response to that discussion...maybe you could answer that? Thanks!
Laura -
Call ref cursor functions in function also returning ref cursor?
In 10g database, I have several functions and procedures, some packaged, that return ref cursors. These work as expected.
Is there a way to call one or more of these in a new function and return another ref cursor?
I know this doesn't work, but I hope it conveys the idea.
function f_get_order_lines
return sys_refcursor -- or defined ref cursor
is
v_ords orders_rcr;
v_lines lines_rcr;
x sys_refcursor;
begin
v_ords := f_get_orders;
for rec in v_ords
loop
v_lines := f_get_lines;
... do other work here...
end loop;
return x;
end;Pipelined table functions might do the trick for you, depending you your requirements and the transformations you need to make:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2345 -
Using XI - RFC table and an Oracle stored procedure that returns a cursor.
I need to create an interface using XI between an RFC table and an Oracle stored procedure that returns a cursor. We are on oarcle 9.2 and SP12.
My stored procedure looks something like this:
CREATE OR REPLACE
PROCEDURE testproc_xi2 (p_recordset1 OUT SYS_REFCURSOR,
in_quoteid IN varchar2 )
AS
BEGIN
OPEN p_recordset1 FOR
SELECT q.quote_id,
q.modified_by,
q.quote_status,
q.total_cost
FROM quote q
WHERE q.quote_id = in_quoteid
AND q.total_cost > 0 ;
END testproc_xi2 ;
My RFC has table and one import parameter .
I wanted to know how to create the data type for the ref cursor? and also for the table type in the RFC?
CAN XI handle multi rows coming from a Stored procedure? Are there any other alternative methods if this is not supported?Any pointers to this would be helpful.
I have called a Oracle SP from an RFC before, but that interface had one input parameter going to the stored procedure from the RFC and about 6 o/p parameters coming from the Stored procedure. This works fine.
Thanks for the help.
MalaMala,
i dont think there is anything called an rfc table...RFC stands for remote function call. That in essence would imply you need a rfc to jdbc connection.
yes XI can handle multiple rows cooming from the the stored procedure if you have them mapped appropriately.
Now as to how to create the data type within xi , you need to know what fields are going to be returned and whether they are nested and then just create them as you would for an xml
for ex
<Details>
<FirstName>
<LastName>
</Details>
that in xi would be smthing like
Details type of data occurence
FirstName type of data occurence
LastName type of data occurence.
Hope that helps.
If it does dont forget the points..:-) -
Is it possible to return a cursor as a HANA Stored Procedure OUT parameter?
Hi,
I have a use case where I need to return a record set from a HANA Stored Procedure to the caller based on a couple of input parameters to the procedure. However, the record set needs to be dynamic and may have different columns based on the input parameters.
I could achieve this by creating hdbstructures or using table types as OUT parameters. However, is it possible to return a cursor holding the result set of a SELECT query as an OUT parameter for a HANA stored procedure?
(I am looking for something similar to Oracle's SYS_REFCURSOR)
Best Regards,
AbhikDid you try using EXECUTE IMMEDIATE
Have a look on this:
SAP HANA: Handling Dynamic Select Column List and Multiple values in input parameter
Regards,
Krishna Tangudu -
How to use Execute Immediate to execute a procedure and return a cursor?
The procedure name is unknown until run time so I have to use Execute immediate to execute the procedure, the procedure return a cursor, but I can't figure out the right syntax to pass the cursor out.
To simplify the issue here, I create two procedures as examples.Assume I have a procedure called XDTest:
p_cur OUT SYS_REFCURSOR
IS
BEGIN
OPEN p_cur FOR
Select * from dummy_table;
END XDTest;
In another procedure, I want to use Execute Immediate to execute XDTest and obtain the result that return from the cursor into a local cursor so I can process the records:
p_cur OUT SYS_REFCURSOR
IS
l_cur SYS_REFCURSOR;
BEGIN
execute immediate 'BEGIN XDTest (:1); END;' using OUT l_cur;
END XDTest2;
However, this is not working, I get ORA-03113: end-of-file on communication channel error.
What syntax should I use here?
Cheerswell...
I update the XDTest2 procedure as below but when execute it get exceptions.I think the v_sqlstmt syntax is wrong, but I don't know what meant to be correct, please give some suggestions .
Cheers
-------------------- XDTest procedure --------------------------------------------------
p_cur OUT SYS_REFCURSOR
--AUTHID CURRENT_USER
IS
BEGIN
OPEN p_cur FOR
Select Table_Name from USER_Tables;
END XDTest;
-------------------- XDTest2 procedure --------------------------------------------------
p_cur OUT SYS_REFCURSOR
IS
TYPE T1 IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER ;
v_sqlstmt varchar2(1000):=null;
v_cursor number;
x_num number;
LN$Lig number := 0 ;
LN$MaxCol number := 0 ;
t T1 ;
v VARCHAR2(4000) ;
userTb User_Tables%ROWTYPE;
l_cur number;
BEGIN
LN$Lig := 0 ;
LN$MaxCol := 1 ;
--OPEN p_cur FOR
--execute immediate 'BEGIN XDTest (:1); END;' using OUT l_cur;
v_cursor:=dbms_sql.open_cursor;
v_sqlstmt:='begin :p_cur:="XDTest"(); END; ';
dbms_sql.parse(v_cursor,v_sqlstmt,DBMS_SQL.NATIVE);
dbms_sql.bind_variable(v_cursor,':p_cur',l_cur);
dbms_output.put_line('1');
-- Define the columns --
dbms_sql.DEFINE_COLUMN(v_cursor, 1, userTb.Table_Name, 30);
x_num:=dbms_sql.execute(v_cursor);
dbms_output.put_line('2');
-- Fetch the rows from the source query --
LOOP
IF dbms_sql.FETCH_ROWS(v_cursor)>0 THEN
-- get column values of the row --
dbms_sql.COLUMN_VALUE(v_cursor, 1,userTb.Table_Name);
dbms_output.put_line(userTb.Table_Name);
ELSE
-- No more rows --
EXIT;
END IF;
END LOOP;
dbms_sql.close_cursor(v_cursor);
END XDTest2;
---------------------- Error when execute ------------------------------------------------
1
BEGIN DevD0DB.XDTest2(:l_cur); END;
ERROR at line 1:
ORA-01007: variable not in select list
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1010
ORA-06512: at "SYS.DBMS_SQL", line 212
ORA-06512: at "DEVD0DB.XDTEST2", line 35
ORA-06512: at line 1
---------------------------------------------------------------------------------------------------- -
Calling Stored Procedure which returns single or multiple value
Hi All Experts,
I have written one stored procedure which is returning different
integer values according to condition.I am calling this
stored procedure through prepareCall() method then executeUpdate() method ,but it is always returning 1,not my desired value.
Pl also tell me,if my stored procedure returns more than one value
then how will i get those values in my java program?
Pl help by writing some sample code.
Thanx in Advance.
Pradipto1) Create CallableStatement
2) For each of returning value you have to call RegisterOutParameter()
3) For others user setXXX() method depending on type of parameter
4) call
5) use vars registered through RegisterOutParameter() - all your values should be there
Pavel -
64bit OraOLEDB failed when calling stored procedure with Ref Cursor
Hi everyone,
I used the ADO VB sample provided with the Oracle 10g provider installation.
But I compiled it in 64bit Visual Studio 2005 and ran on Windows 2003 x64 server.
The function call "cmd.Execute" when it is trying to call a stored procedure which has an Out Ref Cursor parameter. The exception is
"PLS-00306: wrong number or types arguments in call"
I already set the property "PLSQLRSet" to true. But it doesn't help.
The same code works if I compiled in 32 bit.
It also works if the stored procedure does not have Ref Cursor parameter.
I am guessing this is a bug in the 64bit Oracle provider. Anyone can confirm this please? or am I missing anything?
WilsonIt appears to work with 11.1.0.6.20 OLEDB provider but only for ExecuteNonQuery, I'm not able to work with Fill, and yes... in x86 works perfectly, but in x64 we are still having the ORA-06550 and PLS-00306 error.
Our Connection string is as follows:
"Provider=OraOLEDB.Oracle.1;OLEDB.NET=true;Password=xxxxx;Persist Security Info=True;User ID=exxxxx;Data Source=ECOR; PLSQLRSet=True"
We are not using ODP.NET.
Can you confirm that Fill method works with such update? -
Stored procedure that returns a cursor (result set)
Hi,
We have a stored procedure that returns a cursor (result set) but when I compliled it and catalouged (introspected) it in the OBPM I got all the primitive type parameters (either IN or OUT) in the proc call except the cursor type (the result set) which is the out param of the stored proc.
Any pointers please?
ThanksResult set is of RowType and is not supported as a Stored Procedure as far as I know.
HTH
Sharma
Maybe you are looking for
-
I quit, Im tired of signing in so much
Im headed back to cs4. Im so very exahausted from signing in to cloud services so excessivly. I love adobe cloud, but I will not tolerate this behavior towards paying customers. I am one handed and it takes a while for me to sign in. I use Last Pass,
-
Remote Access Question...
Is there a remote access app with which I can open media on a computer or laptop in the apps that support said media or files on my iPad, email these files as a link, email compatable sizes as an attachment, save compatable types to camera roll, Prin
-
I've been using flex time to take a sample in straight time and make it swing, but I've been having playback issues. I get two different error windows 1) Extreme compress factor detected during playback (Elastic Audio) (-10025) and 2) Too many disk I
-
I have a new Linksys wireless router that I successfully installed yesterday. It seems to work fine. But I cannot setup the security because there is no icon in my system tray in the lower right corner of my screen. There are lots of icons there b
-
HELP! exporting to itunes...
this has been bugging me for about a week, i posted earlier...no replies when i click on "export to itunes" in garageband...nothing happens at all, if itunes is closed, it doesnt open, or if its open still nothing happens...i tried disk repair and st