oracle remove line breaks 1

oracle remove line breaks

-- Removes line breaks
DECLARE
    teststring VARCHAR2(32767) := ' This is the value

that I chose';
BEGIN
    DBMS_OUTPUT.PUT_LINE(teststring);
    DBMS_OUTPUT.PUT_LINE(replace(replace(teststring, chr(13), ''), chr(10), ' '));
END;

Here is what the above code is Doing:
1. Declare a variable called teststring and assign it a value. Note that the value has line breaks in it.
2. Print the value of teststring.
3. Print the value of teststring after replacing the line breaks with spaces.
Here’s the output:
This is the value

that I chose
This is the value that I chose

Similar Posts