Solved

SQL Navigator 4 Simple question.

Posted on 2004-08-19
8
2,422 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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Fastest way to replace data in Oracle 5 65
Oracle - SQL Query with Function 3 37
Oracle encryption 12 34
SQL Workhours Count beetween Workhours 3 18
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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 explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

831 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