Home » SQL & PL/SQL » SQL & PL/SQL » remove blank spaces
remove blank spaces [message #317537] Thu, 01 May 2008 18:24 Go to next message
shoaib123
Messages: 118
Registered: December 2007
Location: Chicago
Senior Member

select rpad(name,2)as name, rpad(id,2) as id , rpad(sale_date,9) as sale_date from emp;

name     id       sale_date
qa       12       02-FEB-08
ro       12       02-FEB-08
sh       15       02-FEB-08
qa       54       02-FEB-08
al       54       02-FEB-08
jo       54       02-FEB-08
al       23       02-FEB-08


i am trying to create the fixed format file and trying to remove all spaces between columns. like somewhat like this ..


qa1202-FEB-08
ro1202-FEB-08


Thanks and appreciate your valuable time.
Re: remove blank spaces [message #317538 is a reply to message #317537] Thu, 01 May 2008 18:28 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
so do not separate the columns with commas, but use the concatenation operator instead.
Re: remove blank spaces [message #317539 is a reply to message #317538] Thu, 01 May 2008 18:35 Go to previous messageGo to next message
shoaib123
Messages: 118
Registered: December 2007
Location: Chicago
Senior Member

Thanks and appreciate your valuable time
Re: remove blank spaces [message #317540 is a reply to message #317537] Thu, 01 May 2008 18:40 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
Frequently this approach is used to have SQL write SQL; which can then be executed.

It is desirable to post actual solutions on this forum so future folks can search & find answers without repeating a Frequently Asked Question.
Re: remove blank spaces [message #317574 is a reply to message #317537] Fri, 02 May 2008 00:59 Go to previous message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Also, if you want fixed formats, use TO_CHAR function to convert numbers or dates in the format you want.

Regards
Michel
Previous Topic: look for missing record from the same table
Next Topic: ORA-01002
Goto Forum:
  


Current Time: Thu Dec 08 08:27:20 CST 2016

Total time taken to generate the page: 0.05332 seconds