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

Home -> Community -> Usenet -> c.d.o.misc -> How to display MIN/MAX values in a cursor

How to display MIN/MAX values in a cursor

From: Ubiquitous <weberm_at_polaris.net>
Date: Fri, 15 Oct 2004 19:49:16 +0000 (UTC)
Message-ID: <ckp9jr$qun$1@news.utelfla.com>


I wrote a quick PL/SQL statement to display the range of values in a table but am having trouble with the DBMS_OUTPUT line. It runs fine as a standalone  SELECT statement but not in this. Any ideas on what's wrong? Thanks in advance!

BEGIN
   DECLARE

      CURSOR rcpt_num_cur IS
         SELECT   SUBSTR(receipt_number, 1, 1) INIT,
                  MIN(receipt_number)          MIN_NUM,
                  MAX(receipt_number)          MAX_NUM
             FROM remitter
            WHERE SUBSTR(receipt_number, 1, 1) IN('A', 'D', 'E', 'N')
         GROUP BY SUBSTR(receipt_number, 1, 1);
   BEGIN
      FOR v_rcpt_num IN rcpt_num_cur LOOP
         DBMS_OUTPUT.put_line(v_rcpt_num.init || ' ' || v_rcpt_num.min_num || ' ' || v_rcpt_num.max_num);
      END LOOP;

   END;
END; Received on Fri Oct 15 2004 - 14:49:16 CDT

Original text of this message

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