Currently in address column in test table,i have data in following format,
12th street
Test avenue
Test_City
but in the output,i would require it in following format,
12th street Test avenue Test_City.
Could any one please tell me the query to use to display it in the required manner.
Assuming this is SQL Developer, go to Tools->Preferences (or on Mac, find that under the SQL Developer menu). Expand the Code Editor section and click on Display. Untick "Show whitespace characters" (second checkbox in the list). You can check for defined shortcuts under Preferences, in the Shortcut Keys section.
CHR(10) is used to insert line breaks, CHR(9) is for tabs, and CHR(13) is for carriage returns. In the example above, we wanted to remove all occurrences of the line break, of the tab, and of the carriage return, so we used CHR(10) , CHR(9) , and CHR(13) .
CHR(10) -- Line feed. CHR(13) -- Carriage return. You can use them in insert like this, INSERT INTO table_name (columne_name) VALUES ('ABC' || CHR (9) || 'DEF' || CHR (10) || 'GHI' || CHR (13) || 'JKL') Here is the complete list of ascii values. http://www.asciitable.com/
You can try this:
select regexp_replace(your_address,'[[:space:]]',' ') from your_tab;
Just strip chr(13) and chr(10) from the string:
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;
The result:
This is the value
that I chose
This is the value that I chose
Two spaces since I put in two returns in the text.
Try this:
translate(' example ', chr(10) || chr(13) || chr(09), ' ')
The above will replace all line breaks (chr(10)), all tabs (chr(09)) and all carriage returns (chr(13)) with a space (' ').
Just replace ' example ' with your field name on wish you want to have the characters removed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With