2013-01-15 156 views
3

我有这个sql查询,我写在postgres中。错误:函数regexp_like(字符变化,未知)不存在

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_matches但他们不工作。可能是什么问题呢?

+1

'regexp_like'是Oracle功能。使用postgresql文档来查找可用的功能。 –

+0

以下是Postgresql文档中的一个起点:http://www.postgresql.org/docs/9.2/static/functions-matching.html –

+0

@roykasa当您得到错误“函数.....未知”)不这意味着两件事情(通常)1.它是一种与你正在使用的语言不同的功能2.你错误地键入了一个内置函数;)和第三种可能的(明确地说)你写了一个UDF和错误的东西它.. – bonCodigo

回答

5

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

+2

'regexp_matches()'是另一种选择。 –

相关问题