错误:函数regexp_like(字符变化,未知)不存在

时间:2013-01-15 16:42:39

标签: sql postgresql

我有这个用postgres写的SQL查询。

select  to_char(calldate,'yyyymm') as month,min(calldate) as start_time,max(calldate) as   end_time,
'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::integer in (0,5)
 and regexp_replace(callednumber,'^256','') ~ '^73'
 group by  to_char(calldate,'yyyymm') ,'Onnet'::text,to_char(calldate,'yyyymm') 

它给了我以下错误:

[Err] ERROR:  function regexp_like(character varying, unknown) does not exist
LINE 9: and  regexp_regexp(identifiant,'^73')

我尝试用regexp_like替换regexp_like,但是它们不起作用。可能是什么问题?

2 个答案:

答案 0 :(得分:5)

PostgreSQL等效于regexp_like(identifiant,'^73')identifiant ~ '^73'

答案 1 :(得分:1)

您是否尝试过使用SIMILAR TO运算符?

PostgreSQL文档中的一些摘要:

a. `select 'abc' SIMILAR TO '(a|d)%';`
b. `select 'def' SIMILAR TO '(a|b|c)%';`

声明a返回t(真),因为“ abc”以“ a”或“ d”开头。 语句b返回f(假),因为'def'并非以'a'或'b'或'c'开头。