sys-refcursor

SQL Developer script output truncates sys_refcursor width

為{幸葍}努か 提交于 2019-11-29 16:46:07
I have a function defined that returns a sys_refcursor containing 5 text columns. Sorry, I cannot post the contents of it here for business reasons. The columns are casted to varchar2 with specific widths (9,4,10,10,10). The casting allows me to ensure column widths are constant. In SQL Developer 1.5, printing script output (using F5 from SQL worksheet) displays the contents of the cursor nicely as: MY_FUNCTION(input1,input2,input3) --------------------------------- COLUMN1 COLU COLUMN3 COLUMN4 COLUMN5 --------- ---- ---------- ---------- ---------- 18-NOV-14 TEXT SOME_DATA1 SOME_DATA2 SOME

nhibernate, call function in Oracle which returns sys refcursor

雨燕双飞 提交于 2019-11-29 16:05:25
I am trying to call a function (oracle) using nhibernate that return ref cursor, but i am not successful with the hbm file, can any one please guide me with this. If i make it like <return class ... I am getting configuration error. I tried { ? = call package.function(:a, :b, :c) as result from dual } , even this is also not working. There are some limitations when calling ORACLE functions/procedures with nHibernate. As stated in the reference documentation (17.2.2.1): For Oracle the following rules apply : A function must return a result set. The first parameter of a procedure must be an OUT

nhibernate, call function in Oracle which returns sys refcursor

筅森魡賤 提交于 2019-11-28 10:19:40
问题 I am trying to call a function (oracle) using nhibernate that return ref cursor, but i am not successful with the hbm file, can any one please guide me with this. If i make it like <return class ... I am getting configuration error. I tried { ? = call package.function(:a, :b, :c) as result from dual } , even this is also not working. 回答1: There are some limitations when calling ORACLE functions/procedures with nHibernate. As stated in the reference documentation (17.2.2.1): For Oracle the

Function return sys_refcursor call from sql with specific columns

你说的曾经没有我的故事 提交于 2019-11-28 02:06:29
This may find little silly, but I would like to know whether this is possible. I have a function which return sys_refcursor CREATE OR REPLACE FUNCTION get_employee_details(p_emp_no IN EMP.EMPNO%TYPE) RETURN SYS_REFCURSOR AS o_cursor SYS_REFCURSOR; BEGIN OPEN o_cursor FOR SELECT EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO FROM emp WHERE EMPNO = p_emp_no; RETURN o_cursor; -- exception part END; / and I could get the results using select get_employee_details('7369') from dual; Is it possible to get the result from the above function by specifying column name? E.g. If I would want to get

How to return a RefCursor from Oracle function?

情到浓时终转凉″ 提交于 2019-11-27 23:56:14
I am trying to execute a user-defined Oracle function that returns a RefCursor using ODP.NET. Here is the function: CREATE OR REPLACE FUNCTION PKG.FUNC_TEST (ID IN TABLE.ID%type) RETURN SYS_REFCURSOR AS REF_TEST SYS_REFCURSOR; BEGIN OPEN REF_TEST FOR SELECT * FROM TABLE; RETURN REF_TEST; END; / I can call this function in Toad (select func_test(7) from dual) and get back a CURSOR. But I need to get the cursor using C# and ODP.NET to fill a DataSet, but I keep getting a NullReferenceException - "Object reference not set to an instance of an object". Here is what I have for that:

how to declare %ROWTYPE of a variable that is a weakly typed SYS_REFCURSOR?

和自甴很熟 提交于 2019-11-27 16:06:45
W.r.t code below I can not declare the type of fetch-into-variable as the underlying table's %ROWTYPE because the SYS_REFCURSOR is on a select that joins two tables and also selects a few functions called on the attributes of the underlying two tables; i.e I can't declare as L_RECORD T%ROWTYPE --- DECLARE P_RS SYS_REFCURSOR; L_RECORD P_RS%ROWTYPE; BEGIN CAPITALEXTRACT( P_RS => P_RS ); OPEN P_RS; LOOP BEGIN FETCH P_RS INTO L_RECORD; EXIT WHEN P_RS%NOTFOUND; ... EXCEPTION WHEN OTHERS THEN ... END; END LOOP; CLOSE P_RS; END; -------- CREATE or REPLACE PROCEDURE CAPITALEXTRACT ( p_rs OUT SYS

How to return a RefCursor from Oracle function?

一曲冷凌霜 提交于 2019-11-26 23:22:02
问题 I am trying to execute a user-defined Oracle function that returns a RefCursor using ODP.NET. Here is the function: CREATE OR REPLACE FUNCTION PKG.FUNC_TEST (ID IN TABLE.ID%type) RETURN SYS_REFCURSOR AS REF_TEST SYS_REFCURSOR; BEGIN OPEN REF_TEST FOR SELECT * FROM TABLE; RETURN REF_TEST; END; / I can call this function in Toad (select func_test(7) from dual) and get back a CURSOR. But I need to get the cursor using C# and ODP.NET to fill a DataSet, but I keep getting a NullReferenceException

Function return sys_refcursor call from sql with specific columns

有些话、适合烂在心里 提交于 2019-11-26 22:07:00
问题 This may find little silly, but I would like to know whether this is possible. I have a function which return sys_refcursor CREATE OR REPLACE FUNCTION get_employee_details(p_emp_no IN EMP.EMPNO%TYPE) RETURN SYS_REFCURSOR AS o_cursor SYS_REFCURSOR; BEGIN OPEN o_cursor FOR SELECT EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO FROM emp WHERE EMPNO = p_emp_no; RETURN o_cursor; -- exception part END; / and I could get the results using select get_employee_details('7369') from dual; Is it

How to call an Oracle function with a Ref Cursor as Out-parameter from C#?

余生颓废 提交于 2019-11-26 18:29:17
问题 I'm using a product that provides a database API based on Oracle functions and I'm able to call functions via ODP.NET in general. However, I can't figure out, how to call a function that includes a Ref Cursor as Out-parameter. All the samples I found so far either call a procedure with Out-parameter or a function with the Ref Cursor as return value. I tried to define the parameters similiarly, but keep getting the error that the wrong number or type of parameters is supplied. Here is the

how to declare %ROWTYPE of a variable that is a weakly typed SYS_REFCURSOR?

心不动则不痛 提交于 2019-11-26 17:24:28
问题 W.r.t code below I can not declare the type of fetch-into-variable as the underlying table's %ROWTYPE because the SYS_REFCURSOR is on a select that joins two tables and also selects a few functions called on the attributes of the underlying two tables; i.e I can't declare as L_RECORD T%ROWTYPE --- DECLARE P_RS SYS_REFCURSOR; L_RECORD P_RS%ROWTYPE; BEGIN CAPITALEXTRACT( P_RS => P_RS ); OPEN P_RS; LOOP BEGIN FETCH P_RS INTO L_RECORD; EXIT WHEN P_RS%NOTFOUND; ... EXCEPTION WHEN OTHERS THEN ...