Home > database >  ORACLE FUNCTION returns a cursor
ORACLE FUNCTION returns a cursor

Time:10-04

Function:

The CREATE OR REPLACE FUNCTION TEST111
RETURN SYS_REFCURSOR
IS
Return_cursor SYS_REFCURSOR;
The BEGIN
OPEN return_cursor FOR SELECT c1, 'c2 FROM dual;
RETURN return_cursor;
END;

Using the database tool DbVisualizer 8:

1 SQL:
The select TEST111 () from dual

Results:
NULL

2 directly with the "run" button in the tool, perform:
@ call ${returnValue | | (null) | | Cursor | | nullable noshow ds=0 dt=N/A dir=out} $=TPMS. TEST111 ();

Return results well
C1 c2

What reason is this excuse me, how can call functions in SQL directly use?

CodePudding user response:

Use stored procedures to receive, more intuitive to use

CodePudding user response:

http://blog.csdn.net/sych888/article/details/53170158

CodePudding user response:

Because of the returned result, also need to use in other SQL statements,
So we need to implement a function,

CodePudding user response:

Suggest you to return a value of type varcha2 will more fields to specify a particular character pieced together, the query where do break up, so with respect to ok

CodePudding user response:

Return is not only the content of the field, is also a multiple records,
  • Related