CatDev
CatDev

Reputation: 43

How can I convert datetime to string in PL SQL?

Is it possible to convert a Datetime value to string in PL SQL? I should to do that to a IF in PL SQL

Upvotes: 3

Views: 4999

Answers (2)

CompEng
CompEng

Reputation: 7376

You can use like this:

SELECT  
TO_CHAR(TO_DATE('20190811 10:44:11','YYYYMMDD HH24:Mi:SS'),'YYYYMMDD HH24:Mi:SS') YOUR_STRING_DATE
 FROM
DUAL

Upvotes: 1

Stephen Caggiano
Stephen Caggiano

Reputation: 166

Use to_char(date, format)

e.g.

Select to_char(sysdate,'DD-MON-YYYY') from dual;

Upvotes: 4

Related Questions