Home » SQL & PL/SQL » SQL & PL/SQL » no data found !!
icon5.gif  no data found !! [message #304277] Tue, 04 March 2008 13:11 Go to next message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

the original code in ( PL_SQL Language Reference 11g Release 1 ) is :-

DECLARE
TYPE DateList IS TABLE OF DATE INDEX BY PLS_INTEGER;
dates DateList;
k CONSTANT INTEGER := 5; -- set new increment
BEGIN
FOR j IN 1..3 LOOP
dates(j*k) := SYSDATE; -- multiply loop counter by increment
END LOOP;
END;
/


but when I add this :-

  1  DECLARE
  2  TYPE DateList IS TABLE OF DATE INDEX BY PLS_INTEGER;
  3  dates DateList;
  4  k CONSTANT INTEGER := 5; -- set new increment
  5  BEGIN
  6  FOR j IN 1..3 LOOP
  7  dates(j*k) := SYSDATE; -- multiply loop counter by increment
  8  END LOOP;
  9  for i in dates.first..dates.last loop
 10  dbms_output.put_line(dates(i));
 11  end loop;
 12* END;
SQL> /
04-MAR-08
DECLARE
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 10


give me the previous error ..... I wonder why Question Exclamation

[Updated on: Tue, 04 March 2008 13:14]

Report message to a moderator

Re: no data found !! [message #304281 is a reply to message #304277] Tue, 04 March 2008 13:22 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Because there is no data at index first+1.
You have to use "next" to get the next value and not use .. interval.

Database PL/SQL User's Guide and Reference
Chapter 5 Using PL/SQL Collections and Records
Section Using Collection Methods

Regards
Michel

[Updated on: Tue, 04 March 2008 13:23]

Report message to a moderator

Previous Topic: CASE WHEN problems
Next Topic: insert append over dblink
Goto Forum:
  


Current Time: Sat Dec 10 10:58:28 CST 2016

Total time taken to generate the page: 0.21198 seconds