On Wed, 19 May 1999, Jonathan Lui wrote:
> I am having problems getting the DBMS_OUTPUT to work. I have used the set
> serveroutput on. How do I enable this option?
>
> As well I would like to display a number returned from a select count(*)
> command in a report. Would I have to store this value in an array or would
> I have to put this value temporarily into a field and extract it that way.
>
> Thanks
>
> Jonathan Lui
>
Jonathan,
You can select the count into a variable and then use DBMS_OUTPUT to
display the results:
DECLARE
var_count NUMBER
BEGIN
SELECT COUNT(*) INTO var_count
FROM my_table
WHERE column_1 = 'HAPPY GILMORE';
DBMS_OUTPUT.PUT_LINE('The count is ...');
DBMS_OUTPUT.PUT_LINE(var_count);
END;
/
Best regards,
-Ari Kaplan
Independent Oracle DBA Consultant
<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->
<-> For 295+ Oracle tips, visit my Web Page: <->
<-> <->
<-> www.arikaplan.com <->
<-> <->
<-> email: akaplan@interaccess.com <->
<-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><-><->
Back to Ari Kaplan's Home Page