length(to_char(1, ’00′))=3

知らなかった。2じゃないってこと。符号の1文字分だけ増えるんだな。考えてみればそりゃそうか。
あんまり数字をこうやって扱うことがないから。そんなのが必要な時ってたいてい設計が悪いんじゃん。(言い訳)

PostgreSQL 8.4
pguser=# select length(to_char(1,'00'));
length
--------
3
(1 行)

Oracle 9i
SQL> select length(to_char(1,'00')) from dual;

LENGTH(TO_CHAR(1,'00'))
-----------------------
3

This entry was posted in Tech and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>