How to run anonymous block in sql developer.

JRawabi
JRawabi used Ask the Experts™
on
Hi

I have the following simple anonymous block. I pasted  in sql developer and run the script I got the following message:
anonymous block completed

I do not know how to run it.
Please note I am using Oracle SQL developer 1.5.1

Thanks
Jean
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Sorry here is the code:

DECLARE

          num_age     NUMBER(3) := 20;  -- assign value to variable

BEGIN

          num_age := 23;
DBMS_OUTPUT.PUT_LINE('My age is: ' ||
TO_CHAR(num_age));

END;
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
put and select the code, and run it with F9, normally.what do you get as problem?

Author

Commented:
F9 does not do anything
By the way I have no problem it said anonymous block completed
but nothing printed.
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
to see what is "printed", you need to first show the "dbms_output" window, and then run the pl/sql block...
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
Commented:
the output will only be displayed after the polling interval, which you can configure in that window also...

Author

Commented:
the output window is there
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
possibly, in sql developer 1.5, you have to "activate" the polling ... not sure (using 2.x here)
programmer-analyst
Commented:
In "dbms_output" window at first click on the first icon (enable DBMS output), then
set serveroutput on
appears
and you will see your outputs.

Author

Commented:
Henka
it worked. Thanks but is there another way to print result other than DBMS_OUTPUT.PUT_LINE please?
 
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
apart from using a plain select, no other way...
Helena Markováprogrammer-analyst

Commented:
angelIII is right :)

Author

Commented:
What do you mean?
select will extract data from the database but I am asking about another way for output on screen? other than DBMS_OUTPUT.PUT_LINE
Helena Markováprogrammer-analyst

Commented:
I don't know another way.
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
neither do I
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial