![](/img/trans.png)
[英]SQL: function trunc(timestamp without time zone, "unknown") does not exist
[英]ERROR: function date_trunc(timestamp without time zone) does not exist
我有这个问题。 我有一个 sql 查询正试图对我的 postgres 数据库进行查询。 这些查询在 oracle 中工作正常,但正在将其转换为 postgres 查询,但它会抱怨。 这是查询:
select to_char(calldate,'Day') as Day, date_trunc(calldate) as transdate,
Onnet' as destination,ceil(sum(callduration::integer/60) )as total_minutes,round(sum(alltaxcost::integer) ,2)as revenue
from cdr_data
where callclass ='008' and callsubclass='001'
and callduration::integer >0
and regexp_like(identifiant,'^73')
and bundleunits = 'Money'
and inserviceresultindicator in (0,5)
and regexp_like(regexp_replace(callednumber,'^256','') ,'^73')
group by to_char(calldate,'Day') ,trunc(calldate),'Onnet' order by 2
我得到的错误是这样的:
Err] ERROR: function date_trunc(timestamp without time zone) does not exist
LINE 4: select to_char(calldate,'Day') as Day, date_trunc(calldate)...
我做错了什么,或者这个错误的解决方案是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.