PHP-Oracle请帮助我正则表达式

时间:2019-07-17 11:11:19

标签: php regex oracle

我为Oracle执行构建公式。但是我不好经常。请帮助我。

(CLICK/10)/IMPRESSION => DECODE(IMPRESSION,0,0,(CLICK/10)/IMPRESSION)


RESPONSE/REQUEST    =>  DECODE(REQUEST,0,0,RESPONSE/REQUEST)


CLICK/REQUEST/IMPRESSION = DECODE(IMPRESSION,0,0,DECODE(REQUEST,0,0,CLICK/REQUEST)/IMPRESSION)

请为我提供1个解决方案或1个适用于PHP的专利。

谢谢!

1 个答案:

答案 0 :(得分:1)

我想用CASE..WHEN..END来做,因为它更易读且易于调试。

查看您的答案和我的答案,如下所示:

(CLICK/10)/IMPRESSION 
Your method => DECODE(IMPRESSION,0,0,(CLICK/10)/IMPRESSION)
My Method => (CLICK/10)/(CASE WHEN IMPRESSION = 0 THEN 1 ELSE IMPRESSION END)

RESPONSE/REQUEST    
Your method =>  DECODE(REQUEST,0,0,RESPONSE/REQUEST)
My Method => RESPONSE/(CASE WHEN REQUEST = 0 THEN 1 ELSE REQUEST END)


CLICK/REQUEST/IMPRESSION 
Your method => DECODE(IMPRESSION,0,0,DECODE(REQUEST,0,0,CLICK/REQUEST)/IMPRESSION)
My Method => CLICK/(CASE WHEN REQUEST = 0 THEN 1 ELSE REQUEST END)/(CASE WHEN IMPRESSION = 0 THEN 1 ELSE IMPRESSION END)

干杯!