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: How to do with it?

Re: How to do with it?

From: Oracleguru <oracleguru_at_mailcity.com>
Date: Wed, 26 Aug 1998 21:07:47 GMT
Message-ID: <01bdd145$49de5ca0$a504fa80@mndnet>


In SQL*Plus you have to have the following to have the results come to the screen.

set serveroutput on size 1000000

What dbms_output.put_line does is it puts all output into memory and then puts out everything to the screen once the procedure is completed. The default memorey size is 2000 bytes. The above set command sets it to 1 million bytes.

Another way is to send it to a file:

You have to put the line below in your initXXXX.ora file and restart the database:

utl_file_dir = *

or

utl_file_dir = temp/acct

This will allow you to write to any or specific directory.

The way to do it is something like this. May not be correct syntax:

DECLARE
file_out utl_file.file_type;
BEGIN
file_out := utl_file.fopen
('/temp/acct/utl_file_test.lst','FILE_NAME','W');  utl_file.putf (file_out, 'This is a UTL_FILE test.');  utl_file.fclose (file_out);
EXCEPTION
when others then
dbms_output.put_line
('********** PROBLEM **********');
END; Hope this helps !!!

Oracleguru
www.oracleguru.net
oracleguru_at_mailcity.com

mashy_at_null.net wrote in article <6s12hv$4if$1_at_nnrp1.dejanews.com>...
> See if this is what u are after ....
>
> declare
> vc_name varchar2(2000) ;
> cursor c1 is
> select name
> from test ;
> begin
> vc_name := '';
> for i in c1
> loop
> vc_name := vc_name||' '||i.name ;
> end loop;
> dbms_output.put_line(vc_name);
> end;
>
> Regards !
>
> Mashya
>
> In article <35f069fd.7664475_at_news.twsc.pouchen.com.tw>,
> violin.hsiao_at_mail.pouchen.com.tw (Violin) wrote:
> > Hello,
> > If I have a table with 3 rows:
> > NAME
> > ---------------
> > This
> > is
> > test!
> >
> > And I have a cursor:
> > DECLARE
> > temp CHAR(20);
> > Cursor C1 IS
> > SELECT NAME FROM TEST;
> >
> > And I open the cursor:
> > OPEN C1;
> > LOOP
> > FETCH C1 INTO temp;
> > EXIT WHEN C1%NOTFOUND;
> > /* I want to have the result : 'This is test!'. */
> > temp = ??
> > END LOOP;
> >
> > Please give some tips.
> > Best Regards.
> > Violin
> > violin.hsiao_at_mail.pouchen.com.tw
> >
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
Received on Wed Aug 26 1998 - 16:07:47 CDT

Original text of this message

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