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 -> Re: How to display MIN/MAX values in a cursor

Re: How to display MIN/MAX values in a cursor

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Fri, 15 Oct 2004 17:37:56 -0400
Message-ID: <KKSdnSEy2eHV3u3cRVn-vA@comcast.com>

"Ubiquitous" <weberm_at_polaris.net> wrote in message news:ckp9jr$qun$1_at_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 stand-
| alone 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;
|

error messages? Received on Fri Oct 15 2004 - 16:37:56 CDT

Original text of this message

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