0

I would like to know how to remove white space from my script out string. I am getting two tab(8 space) white space while prints two variable concatenated. But the when I remove the last variable then I get a normal script out on my SQL developer. How to remove white space for printing two variable concatenated with a string? Here is the code I am running.

SET SERVEROUTPUT ON
DECLARE
  SUBTYPE name IS CHAR(20);
  SUBTYPE MESSAGE IS VARCHAR2(100);
  salutation name;
  greetings MESSAGE;
BEGIN
  salutation := 'Reader ';
  greetings  := 'Welcome to the World of PL/SQL';
  SYS.DBMS_OUTPUT.PUT_LINE('Hello ' || salutation || greetings);
END;
/

Here is the screenshot of the script output.

enter image description here

How would I remove the white space I marked with red pen on the image?

1 Answer 1

2

Use VARCHAR2 instead of CHAR. CHAR variables get right-padded to the defined length while VARCHAR2 variables only contain the value you assign.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.