Solved

SQL Navigator 4 Simple question.

Posted on 2004-08-19
8
2,431 Views
Last Modified: 2008-01-09

Here it is:


I try to show a simple string in the output window. so i use this:

dbms_output.put_line('Hello World');


when I run I get an error.


Please help me to find out what to do about this.

or if this not the correct way then how can I show 'hello world" in the output window???





0
Comment
Question by:unknown_routine
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 9

Accepted Solution

by:
pratikroy earned 200 total points
ID: 11843972
I believe you are writing this in SQL Editor Window. You are supposed to be writing the SQL or PL/SQL statements there.

Try to have DBMS_OUTPUT statement within a BEGIN ... END block, like :

BEGIN
dbms_output.put_line('Hello World');
END;
/

0
 
LVL 9

Assisted Solution

by:pratikroy
pratikroy earned 200 total points
ID: 11843996
And, to ensure that you see the output, you will have to click on 'Server Output' which is one of the options in Session (in the top level menu).

Hope this helps !
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 11844122
Thanks for the comments.

Please explain:

<<I believe you are writing this in SQL Editor Window.>>

Where else could I wirte the code?

<<You are supposed to be writing the SQL or PL/SQL statements there.>>


isn't  
 dbms_output.put_line('Hello World');
is any pl/sql code?

<<you will have to click on 'Server Output' >>
Can you explain Server output? what happen if you set it to on and off?


0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 8

Expert Comment

by:Pierrick LOUBIER
ID: 11848166
>Can you explain Server output? what happen if you set it to on and off?
Check http://www.experts-exchange.com/Databases/Oracle/Q_21061102.html
0
 
LVL 8

Assisted Solution

by:annamalai77
annamalai77 earned 100 total points
ID: 11849313
my dear friend

run this from a sql file

sql> ed sample.sql

set serveroutput on
declare
a number := 10;
b varchar2(25) := 'This is a test file';
begin
  dbms_output.put_line('The Number is : ' || to_char(a);
  dbms_output.put_line(b);
end;

save close the file and then run it from sql prompt.

regards
annamalai
0
 
LVL 8

Assisted Solution

by:annamalai77
annamalai77 earned 100 total points
ID: 11849318
sorry friend

missed a ')' in the dbms_output.

corrected one is here

my dear friend

run this from a sql file

sql> ed sample.sql

set serveroutput on
declare
a number := 10;
b varchar2(25) := 'This is a test file';
begin
  dbms_output.put_line('The Number is : ' || to_char(a));
  dbms_output.put_line(b);
end;

save close the file and then run it from sql prompt.

regards
annamalai

0
 
LVL 9

Assisted Solution

by:pratikroy
pratikroy earned 200 total points
ID: 11850681
Dont worry about that comment. You have written in the SQL editor which is correct. I just wanted to tell you that a PL/SQL statement should be written as a PL/SQL statement, within BEGIN .. END statement. Alternatively you could write
EXEC dbms_output.put_line('Hello World');

dbms_output is a package, and has to be executed either within BEGIN ... END statements or, by executing the package with EXEC statement. Hope it is clear now.

<<Can you explain Server output? what happen if you set it to on and off?>>

DBMS_OUTPUT package actually writes to to the SERVER OUTPUT buffer. If the setting is off, you will not be able to see the 'Hello World' in your Output window.

If you have any more questions, please feel free to ask !
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 11851471
Thank's all for bearing with me.


I'm increasing point to 300 and split the points.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle Verification of DataPump Export and Import 17 60
pl/sql - query very slow 26 71
Oracle dataguard 5 45
Fill Null values 5 28
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question