Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.
like image 855
Alapan Bag Avatar asked Apr 09 '16 13:04

Alapan Bag


3 Answers

Try this:

set serveroutput on;

DECLARE
   message  varchar2(20):= 'Hello, World!';
BEGIN
   dbms_output.put_line(message);
END;
/
like image 80
Avrajit Roy Avatar answered Oct 14 '22 10:10

Avrajit Roy


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.

like image 32
Yashashree Kakade Avatar answered Oct 14 '22 09:10

Yashashree Kakade


Additionally to this:

set serveroutput on;

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

like image 24
Alexis Charalambous Avatar answered Oct 14 '22 09:10

Alexis Charalambous