[Last Call] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2009-04-30
Medium Priority
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

mahome earned 240 total points
ID: 24268661
use a regex

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

Open in new window

LVL 15

Accepted Solution

ishando earned 260 total points
ID: 24269467
select trim(TO_CHAR(SYSDATE - 1, 'Month')) || TO_CHAR(SYSDATE - 1, 'DD, YYYY') from dual;


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 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