Solved

SQL remove middle space

Posted on 2004-10-27
1,053 Views
Last Modified: 2008-01-09
I have a situation where I get the following output

select date from dual;
OUTPUT
september2004,
august2004,
september     2004,-----middle space
august    2004-----------middle space

I need the output without middle space

Required output

september2004,
august2004,
september2004,--- without middle space
august2004-------without middle space

Thanks
Srini
0
Question by:srpendyala
    3 Comments
     
    LVL 75

    Accepted Solution

    by:
    A simple replace should work:
    select replace('hello      world',' ','') from dual;
    0
     

    Assisted Solution

    by:akmustafa

    You can use
    select to_char(date,'fmMonth')||to_char(date,'yyyy') from dual
    0
     

    Expert Comment

    by:akmustafa
    You can also use in just one 'to_char' function

    select to_char(date,'fmmonthyyyy') from dual


    in format mask 'fm' excludes spaces.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
    How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
    Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now