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: PL/SQL

Re: PL/SQL

From: <avl_at_norfes.ru>
Date: 2000/03/07
Message-ID: <38c430d4.0@news.pacific.ru>#1/1

Hi !

>I am trying to write a PL/SQL to generate year-begin dates for the past 10
...

Why You are using CURSOR ? Look at this

DECLARE
YEARS INTEGER := 10;
PRIOR_YEAR DATE := TRUNC(TO_DATE(SYSDATE),'YEAR'); PS_REC DATE;
BEGIN
DBMS_OUTPUT.enable();
LOOP
  PS_REC := TRUNC(PRIOR_YEAR - 1,'YEAR');   EXIT WHEN YEARS = 0;
  YEARS := YEARS - 1;
  PRIOR_YEAR := PS_REC;
  DBMS_OUTPUT.put_line(PRIOR_YEAR);
  PRIOR_YEAR := PRIOR_YEAR - 1;
END LOOP;
END; Received on Tue Mar 07 2000 - 00:00:00 CST

Original text of this message

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