SQL 错误:函数 date_trunc(timestamp without time zone) 不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14340999/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ERROR: function date_trunc(timestamp without time zone) does not exist
提问by roykasa
Hey guys i have this problem. I have an sql query am trying to make to my postgres db. These queries work fine in oracle but am in the process of converting it to a postgres query but it complains. This is the query:
嘿伙计们我有这个问题。我有一个 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
And the error am getting is this:
我得到的错误是这样的:
Err] ERROR: function date_trunc(timestamp without time zone) does not exist
LINE 4: select to_char(calldate,'Day') as Day, date_trunc(calldate)...
What am i doing wrong or what is the solution to this error.
我做错了什么或解决此错误的方法是什么。