sys-refcursor

Read Oracle SYS_REFCURSOR in C# Entity Framework?

我们两清 提交于 2021-01-29 14:23:30
问题 I have a simple C# console application and its code is like this: using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Linq; using System.Text; using System.Threading.Tasks; using Oracle.ManagedDataAccess.Client; namespace ConsoleApp1 { class Program { static void Main(string[] args) { SHRSContext shrsContext = new SHRSContext(); DbCommand cmd = shrsContext.Database.Connection.CreateCommand(); cmd.CommandText = "PKG_SHRS.GETLOGINATTEMPT";

SQL Developer script output truncates sys_refcursor width

醉酒当歌 提交于 2020-01-20 08:41:18
问题 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

Fetch data from Oracle SP Out Param SYS_REFCURSOR in Unix Korn Shell Script

拟墨画扇 提交于 2020-01-17 07:13:05
问题 I have a stored procedure in oracle with out parameter as sys ref_cursor. I need to execute the sp from korn shell . read the output and use it as a email body. But i could not find any example code to read sys ref cursor in unix. below is my code. Also how can i read cur ? print cur doesnt seem to print any output. #!/usr/bin/ksh function runproc { #read ref cursor from proc cur=`sqlplus -s $connectiondetails <<EOF SET PAGESIZE 0 FEEDBACK ON VERIFY OFF HEADING OFF ECHO OFF var return_val ;

Best way to check if SYS_REFCURSOR is empty

社会主义新天地 提交于 2020-01-04 14:27:12
问题 I have a cursor with values from a select and i want to do something after depending if i had any row found or none. recs_Table SYS_REFCURSOR; begin open recs_Table for select * from table1, table2; if recs_Table%found then --do this else --do that end if; end; This doesnt seem to work, any help?Ty 回答1: You need to execute a FETCH against the cursor prior to using the %FOUND attribute. Change your code to something like DECLARE recs_Table SYS_REFCURSOR; nTable_1_value NUMBER; nTable_2_value

How to call Oracle Function or Procedure using Hibernate (EntityManager) or JPA

99封情书 提交于 2019-12-27 17:32:27
问题 I have an Oracle function which return sys-refcursor and when I call this function using Hibernate, I am getting the following exception. Hibernate: { ? = call my_function(?) } org.hibernate.exception.GenericJDBCException: could not execute query javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1360) at org.hibernate.ejb.AbstractEntityManagerImpl

How to get refcursor result/output to show as text?

此生再无相见时 提交于 2019-12-25 05:07:06
问题 I'm trying to call a stored procedure in Oracle and show the results of the call, the problem is that it crashes on the line FETCH v_cur into v_a; with error: ORA-06504: PL/SQL: Return types of Result Set variables or query do not match. I guess the output of the query does not match v_a VARCHAR2(100) , but I don't know what to put there instead. The stored procedure that's being called does a join of several tables and selects more than 20+ different columns belonging to different tables. So