有点类似c的宏定义,不知道sql里怎么实现,请各位赐教
比如select to_char(get_date_from_millisecond(tr.time),'yyyy/mm/dd hh24:mi:ss'), b, c from tr
怎么把to_char(get_date_from_millisecond(tr.time),'yyyy/mm/dd hh24:mi:ss')定义为一个常量,方便字段b和字段c调用呢?
先行谢过
比如select to_char(get_date_from_millisecond(tr.time),'yyyy/mm/dd hh24:mi:ss'), b, c from tr
怎么把to_char(get_date_from_millisecond(tr.time),'yyyy/mm/dd hh24:mi:ss')定义为一个常量,方便字段b和字段c调用呢?
先行谢过
例如:GCN_STR_PGM_ID CONSTANT VARCHAR2(20) DEFAULT 'XX010101';或者把to_char(get_date_from_millisecond(tr.time),'yyyy/mm/dd hh24:mi:ss')定义成一个函数function getDateTime (pi_time in date)
return varchar2
is
begin
return to_char(get_date_from_millisecond(pi_time),'yyyy/mm/dd hh24:mi:ss')
end;调用时select getDateTime (tr.time), b, c
from tr;