[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [PL/SQL] Select fra cursor i PL/SQL-funktion?



On 12 Aug 2009 14:06:04 +0200
Jacob Sparre Andersen <sslug@sslug> wrote:

> 
> Mit umiddelbare bud var at bruge en »ref cursor«-type, men så får jeg
> at vide at den kan jeg ikke bruge i min »select«-sætning i funktionen.
> 
Er din cursor af typen stærk eller svag reference?

A cursor variable is a data structure that points to a cursor object,
which in turn points to the cursor's result set. You can use cursor
variables to more easily retrieve rows in a result set from client and
server programs. You can also use cursor variables to hide minor
variations in queries.

The syntax for a REF_CURSOR type is:

    TYPE ref_cursor_name IS REF CURSOR 
       [RETURN record_type];

If you do not include a RETURN clause, then you are declaring a weak
REF CURSOR. Cursor variables declared from weak REF CURSORs can be
associated with any query at runtime. A REF CURSOR declaration with a
RETURN clause defines a "strong" REF CURSOR. A cursor variable based on
a strong REF CURSOR can be associated with queries whose result sets
match the number and datatype of the record structure after the RETURN
at runtime.

To use cursor variables, you must first create a REF_CURSOR type, then
declare a cursor variable based on that type.

The following example shows the use of both weak and strong REF CURSORs:

    DECLARE
       -- Create a cursor type based on the companies   
          table.
       TYPE company_curtype IS REF CURSOR 
          RETURN companies%ROWTYPE;

       -- Create the variable based on the REF CURSOR.
       company_cur company_curtype;

       -- And now the weak, general approach.
       TYPE any_curtype IS REF CURSOR;
       generic_curvar any_curtype;

-- 
Hilsen/Regards
Michael Rasmussen
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917
A computer is like air conditioning: it becomes useless when you open
windows.


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2009-09-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *