2013-01-15 157 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()'是另一種選擇。 –

相關問題