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: beginner question

Re: beginner question

From: Doc Waters <davidmwaters_at_yahoo.com>
Date: 4 Apr 2006 22:03:42 -0700
Message-ID: <1144213422.858256.95660@g10g2000cwb.googlegroups.com>


That really depends on what you want to do with the output. An easy(ish) way is to use the DBMS_OUTPUT package.

Check out the help on the package for the details. It has a few "problems". It doesn't output until the PL/SQL block finishes and it has an upper maximum of bytes it can output. (see http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_output.htm#ARPLS036)

Depending on what client you're using the viewing pane can accessed in different ways.

DECLARE
day3 DATE := '&day1';
day4 DATE := '&day2';
first_name VARCHAR(10);
last_name VARCHAR(10);
perform_value FLOAT;
CURSOR T1Cursor IS
SELECT E.FIRST, E.LAST,
SUM(SI.QUANTITY_SOLD)/SUM(WS.START_TIME.diff(WS.END_TIME)) AS PERFORMANCE

FROM      DEPT D, EMP E, RECEIPT R, SOLD_ITEMS SI, WORKED_SCHEDULE WS
WHERE     D.NAME = 'Cashier' AND D.DEPTNUMBER = E.DEPTNUMBER
          AND R.CASHIERSSN=E.SSN AND R.SALEDATE >= day3 AND R.SALEDATE
<=
day4
          AND R.RECEIPTNUMBER = SI.RECEIPTNUMBER
          AND WS.WSSN=E.SSN AND WS.DAY >= day3 AND WS.DAY <= day4
GROUP BY E.FIRST, E.LAST;
BEGIN DBMS_OUTPUT.ENABLE(1000000); OPEN T1Cursor;
LOOP
FETCH T1Cursor INTO first_name, last_name, perform_value; DBMS_OUTPUT.PUT_LINE(first_name || ' ' || last_name || ' ' || perform_value);
EXIT WHEN T1Cursor%NOTFOUND;
END LOOP;
CLOSE T1Cursor;
END;
. Received on Wed Apr 05 2006 - 00:03:42 CDT

Original text of this message

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