SQL> select to_char(PROD_LENG,'hh24:mi') from production 2 ; select to_char(PROD_LENG,'hh24:mi') from production * ERROR at line 1: ORA-00904: "PROD_LENG": invalid identifier
参考: SQL> select to_char(sysdate,'hh24:mi') from dual;TO_CH ----- 07:58
楼主提供的表里面根本没有prod_leng这个字段所以出现: SQL> select to_char(PROD_LENG,'hh24:mi') from production 2 ; select to_char(PROD_LENG,'hh24:mi') from production * ERROR at line 1: ORA-00904: "PROD_LENG": invalid identifier用to_char()对date类型进行转换,可以转换为需要的类型。
2 ;
select to_char(PROD_LENG,'hh24:mi') from production
*
ERROR at line 1:
ORA-00904: "PROD_LENG": invalid identifier
prod_leng 你应该用number 表示,然后 换算;
注意 两个date型数据相减得到的是以天为单位的number型数据!!!!
谢谢
我查了一下Oracle SQL Reference,但是没有找到to_char(PROD_LENGth,'hh24:mi'),ckc能解释一下那个'th'的作用吗?
SQL> select to_char(sysdate,'hh24:mi') from dual;TO_CH
-----
07:58
SQL> select to_char(PROD_LENG,'hh24:mi') from production
2 ;
select to_char(PROD_LENG,'hh24:mi') from production
*
ERROR at line 1:
ORA-00904: "PROD_LENG": invalid identifier用to_char()对date类型进行转换,可以转换为需要的类型。