Alapan Bag
Alapan Bag

Reputation: 265

Oracle showing only "PL/SQL procedure successfully completed". No output after running the code

This is what it is showing. No output even after running the code block

    SQL> DECLARE
    2     message  varchar2(20):= 'Hello, World!';
    3  BEGIN
    4     dbms_output.put_line(message);
    5  END;
    6  /

    PL/SQL procedure successfully completed.

Upvotes: 10

Views: 24164

Answers (4)

Huseyin Cafarli
Huseyin Cafarli

Reputation: 1

try this

alter session set "_ORACLE_SCRIPT" = true;
set serveroutput on;

Upvotes: 0

Alexis Charalambous
Alexis Charalambous

Reputation: 21

Additionally to this:

set serveroutput on;

try and run then whole script (F5) and not only the statement It worked for me.

Upvotes: 2

Yashashree Kakade
Yashashree Kakade

Reputation: 41

This program I guess is a basic HelloWorld in a PL/SQL Block. There is an extra space between the variable message and it's datatype varchar. Just remove it. And also, while assigning the values, there mustn't be a space between a colon equal to(:=) and the single quotes(''). [It would work :) ]. For eg. in a PL/SQL block we use single quotes('') to declare a string.

Well I am new here. I don't know how Stack Overflow exactly works for a novice like me, but yes some gentlemen or lady has already commented about using the below command:

set serveroutput on; 

Which is absolutely correct as far as my knowledge. It is necessary for executing PL/SQL Programs.

P.s. Do tell me if I am wrong anywhere. I am open to suggestions.

Upvotes: 4

Avrajit Roy
Avrajit Roy

Reputation: 3303

Try this:

set serveroutput on;

DECLARE
   message  varchar2(20):= 'Hello, World!';
BEGIN
   dbms_output.put_line(message);
END;
/

Upvotes: 25

Related Questions