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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Simple? PL/SQL query

RE: Simple? PL/SQL query

From: Uma Sankara_Sivadanam <UmaSankara_Sivadanam_at_satyam.com>
Date: Mon, 4 Sep 2000 19:46:36 +0530
Message-Id: <10609.116154@fatcity.com>


This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.

------_=_NextPart_001_01C0167A.BCA02C90
Content-Type: text/plain

Hi Sean,

The code is working fine.The only possibility could be YOU MIGHT HAVE NOT SET THE SQL*PLUS ENVIRONMENT OPTION "SET SERVEROUTPUT ON" Try setting the option at the sql prompt like this :

SQL>set serveroutput on;

Then run your PL/SQL Code.

Uma Shankar

> ----------
> From: O'Neill, Sean[SMTP:Sean.ONeill_at_organon.ie]
> Reply To: ORACLE-L_at_fatcity.com
> Sent: Monday, September 04, 2000 8:41 AM
> To: Multiple recipients of list ORACLE-L
> Subject: Simple? PL/SQL query
>
> I'm new to PL/SQL and I am trying to use same to send output of name from
> v$database to screen. The code I'm using is as below but the output is
> not
> being sent to screen and I can't figure why not. The code is replying
> with
> "PL/SQL procedure successfully completed." in SQL*Plus. Maybe this is not
> the most appropriate way to approach this requirement and alternative
> method
> inputs are welcome too!. Are there any other ways to send output to
> screen
> aside from DBMS_OUTPUT?
>
> DECLARE
>
> db_name varchar2(20);
>
> BEGIN
> SELECT name
> INTO db_name
> FROM v$database;
> DBMS_OUTPUT.PUT_LINE
> ( 'Database name is ' || db_name );
> END;
>
> /
>
>
> Sean :)
>
> ###### ###### ###### ######
> # # # # # # # # Rookie
> #### # # ###### ###### Data
> # # # # # # # # Base
> # # ####### ###### # # Adminstrator
> -------------------------------- ------------
> Organon (Ireland) Ltd.
> E-mail: sean.oneill_at_organon.ie [subscribed: Digest Mode]
>
> The only man who never makes a mistake is the man who never does anything.
> - Theodore Roosevelt
>
> --
> Author: O'Neill, Sean
> INET: Sean.ONeill_at_organon.ie
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>

------_=_NextPart_001_01C0167A.BCA02C90
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2650.12">
<TITLE>RE: Simple? PL/SQL query</TITLE>
</HEAD>
<BODY>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Hi Sean,</FONT> </P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">The code is working = fine.The only possibility could be YOU MIGHT HAVE NOT SET THE = SQL*PLUS&nbsp; ENVIRONMENT OPTION&nbsp; &quot;SET SERVEROUTPUT = ON&quot;</FONT></P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Try setting the = option at the sql prompt like this :</FONT> </P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">SQL&gt;set = serveroutput on;</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Then run your PL/SQL = Code.</FONT>
</P>

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Uma Shankar</FONT>
</P>
<BR>
<UL>
<P><FONT SIZE=3D1 FACE=3D"MS Sans Serif">----------</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"MS Sans Serif">From:</FONT></B> &nbsp; =
<FONT SIZE=3D1 FACE=3D"MS Sans Serif">O'Neill, =
Sean[SMTP:Sean.ONeill_at_organon.ie]</FONT> <BR><B><FONT SIZE=3D1 FACE=3D"MS Sans Serif">Reply To:</FONT></B> = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D1 FACE=3D"MS Sans = Serif">ORACLE-L_at_fatcity.com</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"MS Sans Serif">Sent:</FONT></B> &nbsp; = <FONT SIZE=3D1 FACE=3D"MS Sans Serif">Monday, September 04, 2000 8:41 = AM</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"MS Sans Serif">To:</FONT></B> = &nbsp;&nbsp;&nbsp; <FONT SIZE=3D1 FACE=3D"MS Sans Serif">Multiple = recipients of list ORACLE-L</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"MS Sans Serif">Subject:</FONT></B> = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D1 FACE=3D"MS Sans = Serif">Simple? PL/SQL query</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">I'm new to PL/SQL and I am trying to = use same to send output of name from</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">v$database to screen.&nbsp; The code = I'm using is as below but the output is not</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">being sent to screen and I can't = figure why not.&nbsp; The code is replying with</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">&quot;PL/SQL procedure successfully = completed.&quot; in SQL*Plus.&nbsp; Maybe this is not</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">the most appropriate way to approach = this requirement and alternative method</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">inputs are welcome too!.&nbsp; Are = there any other ways to send output to screen</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">aside from DBMS_OUTPUT?</FONT> </P>

<P><FONT SIZE=3D2 FACE=3D"Arial">DECLARE</FONT> </P>

<P><FONT SIZE=3D2 FACE=3D"Arial">db_name varchar2(20);</FONT> </P>

<P><FONT SIZE=3D2 FACE=3D"Arial">BEGIN</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp; SELECT name&nbsp; =
</FONT>
<BR><FONT SIZE=3D2 =

FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTO = db_name</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2 = FACE=3D"Arial">FROM v$database;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = DBMS_OUTPUT.PUT_LINE</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( 'Database = name is ' || db_name );</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">END;</FONT> </P>
<P><FONT SIZE=3D2 FACE=3D"Arial">/</FONT>
</P>
<BR>

<P><FONT SIZE=3D2 FACE=3D"Arial">Sean :)</FONT> </P>

<P><FONT SIZE=3D2 FACE=3D"Arial">######&nbsp;&nbsp; ######&nbsp; = ######&nbsp; ###### </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">#&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp; = #&nbsp;&nbsp;&nbsp; #&nbsp; #&nbsp;&nbsp;&nbsp; #&nbsp; = #&nbsp;&nbsp;&nbsp; #&nbsp; Rookie</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">####&nbsp;&nbsp;&nbsp;&nbsp; = #&nbsp;&nbsp;&nbsp; #&nbsp; ######&nbsp; ######&nbsp; Data</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">#&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp; = #&nbsp;&nbsp;&nbsp; #&nbsp; #&nbsp;&nbsp;&nbsp; #&nbsp; = #&nbsp;&nbsp;&nbsp; #&nbsp; Base </FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">#&nbsp;&nbsp;&nbsp; #&nbsp; = #######&nbsp; ######&nbsp; #&nbsp;&nbsp;&nbsp; #&nbsp; = Adminstrator</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Arial">-------------------------------- =
------------ </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Organon (Ireland) Ltd.</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">E-mail: = sean.oneill_at_organon.ie&nbsp;&nbsp; [subscribed: Digest Mode]</FONT> </P>

<P><FONT SIZE=3D2 FACE=3D"Arial">The only man who never makes a mistake = is the man who never does anything.</FONT> <BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;- Theodore Roosevelt</FONT> </P>

<P><FONT SIZE=3D2 FACE=3D"Arial">-- </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Author: O'Neill, Sean</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp; INET: =
Sean.ONeill_at_organon.ie</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">Fat City Network = Services&nbsp;&nbsp;&nbsp; -- (858) 538-5051&nbsp; FAX: (858) = 538-5051</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">San Diego, = California&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Public Internet = access / Mailing Lists</FONT>
<BR><FONT SIZE=3D2 =

FACE=3D"Arial">---------------------------------------------------------=
-----------</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">To REMOVE yourself from this mailing = list, send an E-Mail message</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">to: ListGuru_at_fatcity.com (note EXACT = spelling of 'ListGuru') and in</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">the message BODY, include a line = containing: UNSUB ORACLE-L</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">(or the name of mailing list you want = Received on Mon Sep 04 2000 - 09:16:36 CDT

Original text of this message

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