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: Q: inconsistency between sql and pl/sql

Re: Q: inconsistency between sql and pl/sql

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Thu, 14 Oct 1999 19:27:21 +0800
Message-ID: <3805BE19.2439@yahoo.com>


tedchyn_at_yahoo.com wrote:
>
> Sir, why am I getting this inconsistency between sql and pl/sql for
> identical sql statement (sql 10 rows and pl/sql 5 rows).
>
> Thanks in advance ted chyn
>
> SQL> select to_char(odate,'yyyy-mon') from c_order
> 2 group by to_char(odate,'yyyy-mon') ;
>
> TO_CHAR(
> --------
> 1973-nov
> 1999-apr
> 1999-aug
> 1999-jul
> 1999-jun
> 1999-mar
> 1999-may
> 1999-oct
> 1999-sep
> 2000-sep
>
> 10 rows selected.
>
> SQL> declare v_date varchar2(100);
> 2 cursor cur1 is select to_char(odate,'yyyy-mon') from c_order
> 3 group by to_char(odate,'yyyy-mon') ;
> 4 begin
> 5 for rec in cur1 loop
> 6 fetch cur1 into v_date;
> 7 dbms_output.put_line(v_date);
> 8 end loop;
> 9 end;
> 10 /
> 1999-apr
> 1999-jul
> 1999-mar
> 1999-oct
> 2000-sep ** only 5 rows here
>
> PL/SQL procedure successfully completed.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

remove the fetch since the for-endloop is already doing this... --



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Thu Oct 14 1999 - 06:27:21 CDT

Original text of this message

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