Q

LTRIM function

I am having trouble with zero suppression of the time function. LTRIM(TO_CHAR(S_DATE, 'HH:MI AM'). I'm on 9i. The

results looks like this: 08:00 AM. The LTRIM function will remove any set of characters from the left side of the string. Since you did not tell it which set of characters to trim off the string, the LTRIM function will remove any blanks from the left side of the string. The RTRIM function works similarly, but from the right side of the string. You are converting a date field to a string and then LTRIM will remove any leading blanks. Unfortunately, with your function, there are no leading blanks. If you wish to remove the leading zero, then you'll need to let LTRIM know this as follows:

LTRIM(TO_CHAR(S_DATE, 'HH:MI AM'),'0')

The second parameter to the LTRIM function tells it to remove the leading zero.

This was first published in October 2003

Dig deeper on Oracle database design and architecture

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close