How can I remove the sspaces after my month when i run this query?

Posted on 2009-04-30
Last Modified: 2013-12-19
Hi there,

When I run this:
select TO_CHAR(SYSDATE - 1, 'MonthDD, YYYY') from dual
I get:
April    29, 2009                  
How can i remove a few spaces after the month?

Question by:Rhonda Carroll
    LVL 10

    Assisted Solution

    use a regex

    REGEXP_REPLACE(TO_CHAR(SYSDATE - 1, 'MonthDD, YYYY'),'( ){2,}', ' ')

    Open in new window

    LVL 15

    Accepted Solution

    select trim(TO_CHAR(SYSDATE - 1, 'Month')) || TO_CHAR(SYSDATE - 1, 'DD, YYYY') from dual;


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
    This post first appeared at Oracleinaction  ( Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
    This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

    745 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

    13 Experts available now in Live!

    Get 1:1 Help Now