sys-refcursor

Return the SQL Statement of an Explicit Cursor

北战南征 提交于 2019-12-10 11:26:23
问题 Taking the example shown in Oracle Forums: Generating excel(xls) using plsql, i would like to generate an excel file from a query's data set. The example provided there works. however, there are some challenges i'm encountering: My SQL query is quite long and exceeds the VARCHAR2 4000 Character limitation. I would like to pass parameters to my query. I would like to do it in a very simple manner and without using Dynamic SQL (if possible). What I've come up is something like below: Package

JPA and SYS_REFCURSOR like OUT parameter

╄→尐↘猪︶ㄣ 提交于 2019-12-08 11:00:18
问题 I want to call a procedure using JPA with SYS_REFCURSOR like OUT parameter. This is very easy using plain JDBC but I'm not sure that is possible in JPA. My procedure is like following: CREATE OR REPLACE FUNCTION FN_GET_COINS RETURN SYS_REFCURSOR IS vCursor SYS_REFCURSOR; BEGIN OPEN vCursor FOR SELECT ... RETURN vCursor; CLOSE vCursor; EXCEPTION ... END FN_GET_COINS; 回答1: JPA 2.0 has no support for stored procedures, but support has been added in JPA 2.1 , part of Java EE 7 . Examples of

Ref cursor with Execute immediate

时光怂恿深爱的人放手 提交于 2019-12-07 22:50:29
问题 I want to get the results in ref_cursor, but I am not able to do that. Please suggest me how to get the results in ref_cursor using Execute immediate CREATE OR REPLACE PROCEDURE TEST_PROC_QT ( p_name IN VARCHAR2, p_result_set OUT sys_refcursor ) IS v_sql VARCHAR2(4000); BEGIN v_sql := ''; v_sql := 'SELECT * FROM USERS WHERE 1=1 '; IF p_name is not null THEN v_sql := v_sql || ' AND login_id = :v_name'; ELSE v_sql := v_sql || ' AND ((1=1) or :v_name is null)'; END IF; Dbms_output.put_line(v_sql

How to call function using EclipseLink

Deadly 提交于 2019-12-06 10:49:09
问题 How to call an Oracle function which returns sys_refcursor using EclipseLink? There is a documentation which states about calling a function, but not sure how to call a function which returns sys_refcursor. http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_namedstoredfunctionquery.htm I have tried as follows @NamedStoredFunctionQuery(name = "findEmployees", functionName = "getEmps", parameters = { @StoredProcedureParameter(queryParameter = "user", name = "username", direction

Return the SQL Statement of an Explicit Cursor

这一生的挚爱 提交于 2019-12-06 08:02:18
Taking the example shown in Oracle Forums: Generating excel(xls) using plsql , i would like to generate an excel file from a query's data set. The example provided there works. however, there are some challenges i'm encountering: My SQL query is quite long and exceeds the VARCHAR2 4000 Character limitation. I would like to pass parameters to my query. I would like to do it in a very simple manner and without using Dynamic SQL (if possible). What I've come up is something like below: Package Definition: create or replace package tabletoexcel as PROCEDURE run_query(p_fh IN UTL_FILE.FILE_TYPE , p

How to call function using EclipseLink

空扰寡人 提交于 2019-12-04 15:39:11
How to call an Oracle function which returns sys_refcursor using EclipseLink? There is a documentation which states about calling a function, but not sure how to call a function which returns sys_refcursor. http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_namedstoredfunctionquery.htm I have tried as follows @NamedStoredFunctionQuery(name = "findEmployees", functionName = "getEmps", parameters = { @StoredProcedureParameter(queryParameter = "user", name = "username", direction = Direction.IN, type = String.class) } , returnParameter = @StoredProcedureParameter(queryParameter =

How to use jmeter to test an Oracle Stored Procedure with sys_refcursor return type?

こ雲淡風輕ζ 提交于 2019-12-04 06:01:52
问题 I want to test an Oracle Stored Procedure by using jmeter.I have done everything but parameters. And here is my SQL Query: declare outinfo varchar2(20); outtable sys_refcursor; begin {call RK_JSCX(?,?)}; end; The outtable in Oracle is a cursor.And i used resultSet to contain it in java.However,whatever i set in parameter types ,it said invalid type. Sample Start: 2012-10-25 16:06:41 CST Load time: 0 Latency: 0 Size in bytes: 25 Headers size in bytes: 0 Body size in bytes: 25 Sample Count: 1

How to display a sys_refcursor data in TOAD's DataGrid

别来无恙 提交于 2019-12-03 09:38:11
问题 Please i need help. (I SEARCHED A lot and get more confused . ) I use Toad 9.7.25 and i made this procedure (in a package) PROCEDURE ReportaCC(pfcorte IN DATE, lcursor IN OUT SYS_REFCURSOR) IS BEGIN OPEN lcursor FOR select c1, c3, c3 from table1 where hdate = pfcorte; close lcursor; END; In toad's sql editor i´d like execute that procedure and show the cursor results in toad's datagrid: --- I WANT THIS CODE CAN EXECUTE IN TOAD'S SQL EDITOR. DECLARE PFCORTE DATE; LCURSOR SYS_REFCURSOR; BEGIN

Oracle EXECUTE IMMEDIATE into a cursor

拜拜、爱过 提交于 2019-12-01 04:34:22
I have a stored procedure which used the EXECUTE IMMEDIATE command to execute a very long string. How do I support a very long string and return the data into a refcursor? Assuming that your SQL is not longer than 32K (as @Tony Andrews hinted at), you should be able to use something like this: declare SQL_Text varchar2(32760) := 'select * from dual'; --your query goes here cur sys_refcursor; begin open cur for SQL_Text; end; When working with Ref Cursors, open-for can be used directly, instead of execute immediate . 来源: https://stackoverflow.com/questions/4714163/oracle-execute-immediate-into

How to access the structure and get the column list ,datatypes of refcursor?

こ雲淡風輕ζ 提交于 2019-11-30 07:39:38
问题 I have a procedure which gets me the output with refcursor and data/structure in cursor will be dynami. Each time depending on inputs datatypes and no of columns in cursor will vary. So how can I access this structure and get the datatypes ? PROCEDURE PROC_B ( name_ IN VARCHAR2, date_ IN DATE, code_ IN VARCHAR2, sp_name_ IN VARCHAR2, wrapper_ OUT sys_refcursor, datyapes_ OUT VARCHAR2, TS2_ OUT VARCHAR2, header_ OUT VARCHAR2) AS TS_ DATE; BEGIN PROC_A (name_, date_, code_, sp_name_, wrapper_,