SQL Language (MOSC)

MOSC Banner

I have a question about cursors.

edited Mar 30, 2016 11:15AM in SQL Language (MOSC) 9 commentsAnswered

I have the following sample code:

create table test_tableAA

(vchcola varchar2(10),vchcolb varchar2(10))

/

insert into test_tableAA values('aa','bb')

/

insert into test_tableAA values('cc','dd')

/

insert into test_tableAA values('ee','ff')

/

commit

/

declare

cursor test_curs is

  select  vchcola, vchcolb

   from test_tableAA;

r_test test_curs%ROWTYPE;

L_vchcola varchar2(10);

L_vchcolb varchar2(10);

begin

dbms_output.put_line('Start');

open test_curs;

loop

   fetch test_curs into r_test;

   exit when test_curs%NOTFOUND;

   L_vchcola := r_test.vchcola;

   L_vchcolb := r_test.vchcolb;

   dbms_output.put_line('L_vchcola='||L_vchcola||', L_vchcolb='||L_vchcolb);

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center