Formation of certain roles PL / SQL

Asked By 90 points N/A Posted on -
qa-featured

 

 

Hello,

My request for support from more skillful associates, as I am unable to realize the following query.

The query is:

The formation of certain roles PL / SQL, which, by means of a cursor variable to be read two records of a database table and the next two, will transfer to the caller program in which that will be shown.

Function code I am getting in the following manner:

CREATE OR REPLACE FUNCTION used type REF CURSOR is KURS_MAIN_TIPS;

kurs_1 KURS_MAIN_TIPS;

kurs_1 RETURN IS raksts kurs_1% ROWTYPE;

I number; BEGINOpen kurs_1 for select * from club; for I in 1 .. 4 loops fetch kurs_1 INTO racists (I); DBMS_OUTPUT. PUT_LINE (racists (I));

End loop;

Racists RETURN (I);

END;

As we can get while I run the cycle for 4 entries, as assume that a sample of two of the four occurs exactly in the calling program? And actually, I am not aware of how to create a calling program, so I cannot imagine that it declares, like all of the data already existing in the function…

Please let me know in which direction to go.

SHARE
Answered By 70 points N/A #159183

Formation of certain roles PL / SQL

qa-featured

The PL/SQL Developers are contained within the growth form that is definitely struggling on the development of the increasing program units of the Oracle Databases.

You can try the following steps below to resolve your problem:

Use the GET a REF cursor as stated below:

1. GET (cursor_name: host_cursor_variable_name)

2. INTO (variable1}, variable2...} record_name): 

The amendable has to oppose in both number and positional the Columns listed on the REF cursor OPEN statements. And the type of information have to either oppose or be a companion. The fetch declaration regain the lines one by one from the consequence placed on a multi-row query or in other words, it leads the cursor on the following row.

SHOUT a REF cursor:
1. SHOUT (cursor_name |: host_cursor_variable_name);
2. Shouting a cursor liberates the circumstance region. 
 REF Cursor features:
 1. Cursor ROWTYPE - revisits the data type of the underlying table
2. Cursor ROWCOUNT - int - figure of rows fetched so far
3. Cursor NOTFOUND - bool - TRUE if 0 rows revisited
4. Cursor FOUND    - bool - TRUE if >1 row revisited
5. Cursor ISOPEN   - bool - TRUE if cursor still released

 

Login/Register to Answer

Related Questions