質問

I read a lot of tutorial which uses hh23 and hh24 interchangeably. to do to_char on oracle. Is the hh23 a legacy syntax? I tried doing it on simple query and it causes an error.

select to_char(sysdate, 'hh23'), to_char(sysdate, 'hh24') from dual

I'm trying to find a reference to this but there is none. Or is the tutorial just written wrong? For example on http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:59412348055.

役に立ちましたか?

解決

I think it's just a typo.

SQL> select to_char(sysdate, 'hh23:mi:ss') from dual
  2  /
select to_char(sysdate, 'hh23:mi:ss') from dual
                        *
ERROR at line 1:
ORA-01821: date format not recognized


SQL> select to_char(sysdate, 'hh24:mi:ss') from dual
  2  /

TO_CHAR(
--------
11:25:21

SQL>

他のヒント

It is just a typing error in untested code. 'hh23' will always give an error.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top