1

I'm new to PL/SQL and I want to show the following message. When I compile it in SQL Developer I only get

  PL/SQL procedure successfully completed.

My code is this:

SET SERVEROUTPUT ON;

DECLARE
  mesaj VARCHAR2 (100) := 'PL/SQL';
BEGIN
  DBMS_OUTPUT.PUT(mesaj);
END;
/
Stefan
  • 83
  • 1
  • 6
  • 20

2 Answers2

5

You need to add an end-of-line marker by calling DBMS_OUTPUT.NEW_LINE;. End-of-line marker is added by PUT_LINE but not by PUT.

SET SERVEROUTPUT ON;

DECLARE
  mesaj VARCHAR2 (100) := 'PL/SQL';
BEGIN
  DBMS_OUTPUT.PUT(mesaj);
  DBMS_OUTPUT.NEW_LINE;
END;
/
user3738870
  • 1,415
  • 2
  • 12
  • 24
Nitish
  • 1,686
  • 8
  • 23
  • 42
0

The PUT procedure and PUT_LINE procedure in this package enable you to place information in a buffer that can be read by another procedure or package.

When you call PUT_LINE, the item you specify is automatically followed by an end-of-line marker.

If you make calls to PUT to build a line, you must add your own end-of-line marker by calling NEW_LINE, or you can try DBMS_OUTPUT.PUT_LINE which appends each line with an end-of-line marker.

SET SERVEROUTPUT ON;

DECLARE
  mesaj VARCHAR2 (100) := 'PL/SQL';
BEGIN
  DBMS_OUTPUT.PUT_LINE(mesaj);
END;
/

PUT - This procedure places a partial line in the buffer. PUT_LINE - This procedure places a line in the buffer.

Tanya Sethi
  • 33
  • 1
  • 8
  • This is a 4+ year old question ... that you answered essentially with the same content as the 4 year old comment by Hellmar Becker .... why? – Patrick Artner May 10 '20 at 08:39