[pgsql-jp: 25663] Re: time型データの表示
ichikawa @ is.ocha.ac.jp
ichikawa @ is.ocha.ac.jp
2002年 4月 23日 (火) 15:22:00 JST
市川@お茶大です.
At Tue, 23 Apr 2002 15:15:45 +0900,
Takao Kato wrote:
>
> 加藤@川崎です。
> # 現実逃避 --;
>
> > id day start
> > ------------------------------
> > 10 2002年4月23日 10時30分
> >
> > select id, to_char(day,'YYYY年MM月DD日') as day,
> > to_char(start,'HH24時MI分') as start from hoge where id=10 ;
> > とエラーになってしまいます。
> > ERROR: Function 'to_char(time, unknown)' does not exist
> > Unable to identify a function that satisfies the given argument types
> > You may need to add explicit typecasts
> >
>
> かなりあこぎな方法だと思いますが、
>
> # select id,to_char(day::timestamp,'YYYY年MM月DD日') as day,
> # substr(start,1,2) || '時' || substr(start,4,2) || '分' as start
> # from hoge where id = 10;
>
> てのでは駄目ですか?もっとスマートな解は...お任せします > 有識者
> # VIEW使うと多少綺麗かな ^^;
time から timestampe に一度キャストできれば良いのですから,
select id, to_char(day,'YYYY年MM月DD日') as day,
to_char(timestamp(date,start),'HH24時MI分') as start from hoge where id=10 ;
で OK では?
----
市川哲彦
お茶の水女子大学 理学部 情報科学科
Phone: 03-5978-5708; Fax: 03-5978-5705
E-mail: ichikawa @ is.ocha.ac.jp
pgsql-jp メーリングリストの案内