Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: select inside a cursor problem

Re: select inside a cursor problem

From: SoulSurvivor <markyg_7_at_yahoo.co.uk>
Date: 14 May 2003 05:47:43 -0700
Message-ID: <8d9c6fd.0305140447.3ef65e0e@posting.google.com>


I have no idea what the code does fron a business point of view. But if line

> if v_id_cnt = 1 then

doesnt equal 1, write_log will never be called.

Do you want the

> write_log('TESTING',v_id||' - '||v_id_cnt);

after the end if but before the end loop??

Mark

markbathie_at_go.com (Mark Bathie) wrote in message news:<e55d17df.0305132146.3c59e7e4_at_posting.google.com>...
> Hi,
>
> I am trying to execute some PL/SQL. The basic idea is I have a cursor
> and wish to iterate through each row using a for loop. Within that
> loop I'm simply selecting a value from another table using "select
> into". The problem is that it should be returning 40,000odd rows,
> instead it stops at 350. I just can figure out why is stops way short
> of 40,000. Any ideas.
>
> create or replace procedure TEST
> is
> v_id people.id%TYPE;
> cursor c_select is
> select *
> from vw v
> where emplid > 34400000
> order by emplid;
>
> v_id_cnt integer;
> v_rowcnt integer := 0;
> BEGIN
> for i in c_select loop
> v_id_cnt := 0;
> select count(*) into v_id_cnt from people where uqid=i.emplid;
> if v_id_cnt = 1 then
> select id
> into v_id
> from people
> where uqid=i.emplid
> write_log('TESTING',v_id||' - '||v_id_cnt);
> end if;
> end loop;
> END;
>
> It should be calling the write_log procedure 40,000 times, but stops
> at 350 !
>
> Cheers,
>
> Mark.
Received on Wed May 14 2003 - 07:47:43 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US