to_charとto_date

軍鶏/ 7月 10, 2020/ 未分類

よく忘れるのでメモ

・基本的にto_charはSELECTするときに表示形式を指定
・to_date は、where句などにおいて日付で絞りたいときに指定

例)
select username from dba_users where PASSWORD_CHANGE_DATE < to_date('2020/07/07','YYYY/MM/DD');

select to_char(created, 'YYYY/MM/DD hh24:MI:SS') from dba_users where account_status='OPEN';

Share this Post