Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Handling multiple spaces in a column
Handling multiple spaces in a column [message #300630] Sat, 16 February 2008 23:12 Go to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
i have stored "a b xyz d" in particular column.
When i used it in report displayed as "a b xyz d".
mulitple space characters are getting shrinked to single space character. i want to store multiple space characters as data. how to do it?

[EDITED by LF]
As a new user of the OraFAQ Forum, perhaps you should first test your skills in the "Test" forum (the last one in the forum list). Check what BBcode means and how to use it in order to improve readability.

For example, your message might look like this (and other forum members might easier understand what you meant to say); I'll use [pre] tags to preserve formatting:
Quote:

i have stored
a    b     xyz     d
in particular column. When i used it in report displayed as
a b xyz d

See the difference?

Next time, please, format it yourself.

[MERGED by LF]

[Updated on: Mon, 18 February 2008 00:33] by Moderator

Report message to a moderator

Re: handling multiple spaces in coloumn [message #300636 is a reply to message #300630] Sun, 17 February 2008 02:33 Go to previous messageGo to next message
Michel Cadot
Messages: 64153
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code.
Use the "Preview Message" button to verify.

Using standard font in your post, there is no difference in what you posted you have and what you posted you want.
In addition, your question is not clear, do you want:
- to have multiple spaces in your data?
- to have single space in your data?
- to have multiple spaces in output?
- to have single space in output?
Which combination of above?

Always post your Oracle version (4 decimals).

Regards
Michel
Re: handling multiple spaces in coloumn [message #300649 is a reply to message #300636] Sun, 17 February 2008 06:32 Go to previous messageGo to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
i need multiple spaces in output and as well as in input data also
Re: handling multiple spaces in coloumn [message #300654 is a reply to message #300649] Sun, 17 February 2008 08:54 Go to previous messageGo to next message
Michel Cadot
Messages: 64153
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is what Oracle gives you.
Oracle does not modify the data it outputs unless you ask it to do so.

Regards
Michel
Re: handling multiple spaces in coloumn [message #300680 is a reply to message #300654] Sun, 17 February 2008 14:57 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8636
Registered: November 2002
Location: California, USA
Senior Member
If you are running SQL from SQL*Plus or one of many other things, then Oracle preserves the spaces. However, when using Apex, by default, it replaces all multiple spaces with single spaces. However, there are some workarounds. For example, if you are creating your report from a sql query, you can replace each space with &nbsp to preserve the spaces as non-breaking spaces. Here is an example:

select replace("TEST_TAB"."TEST_COL",' ',' ') as "TEST_COL"
from "TEST_TAB" "TEST_TAB"

Re: handling multiple spaces in coloumn [message #300722 is a reply to message #300680] Sun, 17 February 2008 23:17 Go to previous messageGo to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
Sir,

Thank you very much for the excellent reply. I was in need of this type of solution for a quite longer time. It has given enormous joy to put an end to my search. I like to know is it possible to use &nbsp in lpad and rpad functions. If so it reduceds some of my research. I am very much newbies on using orafaq. I am sorry if i make mistake on my expression.
urs
dr.s.raghu
Re: stored multiple space characters being 'shrinked' [message #300731 is a reply to message #300630] Sun, 17 February 2008 23:40 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What did this have to do with the thread against which you placed it?

Is this an Oracle Forms or Reports question? Which version? Which operating system?

David
Re: handling multiple spaces in coloumn [message #300743 is a reply to message #300722] Mon, 18 February 2008 00:32 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8636
Registered: November 2002
Location: California, USA
Senior Member
You would need to use ' ' with lpad or rpad, then wrap the replace around it, like so:

select replace (lpad ("TEST_TAB"."TEST_COL", 30, ' '), ' ',' ') as "TEST_COL"
from "TEST_TAB" "TEST_TAB"

However, I have to wonder why you would use lpad or rpad when you can just use left alignment or right alignment.



Re: stored multiple space characters being 'shrinked' [message #300745 is a reply to message #300731] Mon, 18 February 2008 00:34 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8636
Registered: November 2002
Location: California, USA
Senior Member
David,

This was originally in the newbies forum, but the subtitle said 10g and apex report, so I moved it to the Apex forum, however, it looks like it lost the subtitle when I did that.

Barbara
Re: stored multiple space characters being 'shrinked' [message #300819 is a reply to message #300745] Mon, 18 February 2008 03:18 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Furthermore, as @dr.s.raghunathan opened more than one topic about the same problem, I've moved the one from the Forms forum and merged it with this one.
Previous Topic: Getting number of hits in a report
Next Topic: Single column multiple row alignment of data within column problem
Goto Forum:
  


Current Time: Sun Dec 11 02:12:09 CST 2016

Total time taken to generate the page: 0.07063 seconds