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

4

9

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.
Decongestant answered 9/4, 2016 at 13:57 Comment(1)
Set serveroutput on; and then try.Astrionics
A
25

Try this:

set serveroutput on;

DECLARE
   message  varchar2(20):= 'Hello, World!';
BEGIN
   dbms_output.put_line(message);
END;
/
Astrionics answered 9/4, 2016 at 14:6 Comment(2)
Still i am getting same issue is there any alternative way to show outputUnbraid
Will this be applied only to the current session?Apperceive
C
4

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.

Caisson answered 30/10, 2021 at 12:46 Comment(0)
G
2

Additionally to this:

set serveroutput on;

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

Gatha answered 9/12, 2021 at 11:5 Comment(0)
S
0

try this

alter session set "_ORACLE_SCRIPT" = true;
set serveroutput on;
Scherzo answered 12/4, 2023 at 19:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.