Sixty4Bit
Sixty4Bit

Reputation: 13402

What is the best way to escape non-format characters in Oracle's to_char?

I am trying to print a date in a select statement, but I need to add a letter to the output:

to_char(date_updated, 'YYYY-MM-DDTHH:mm:ss')

Oracle does not like the T. I just want the T to be output like the colons and the dashes. Can I escape it with a backslash or something?

Upvotes: 55

Views: 13931

Answers (1)

Chad Birch
Chad Birch

Reputation: 74638

You just need double-quotes around it:

to_char(date_updated, 'YYYY-MM-DD"T"HH:mm:ss')

Upvotes: 99

Related Questions