2016-09-14 64 views
2

我想使用附加條件來更新事件表(RDBMS),即其中的一列不爲空。表名是MSISDNProfileDB,它在oracle數據庫中。使用wso2 CEP處理空值

from incomingStream#window.length(1) 
select correlation_MSISDN as MSISDN, 
     INTERACTION_DT as INTERACTION_DT 
update MSISDNProfileDB 
on MSISDNProfileDB.MSISDN == MSISDN 
and not(MSISDNProfileDB.column1 is null); 

它驗證代碼,但不更新INTERACTION_DT。出於測試目的,我將其更改爲檢查列是否爲空,並手動從column1中刪除數據。

from incomingStream#window.length(1) 
select correlation_MSISDN as MSISDN, 
     INTERACTION_DT as INTERACTION_DT 
update MSISDNProfileDB 
on MSISDNProfileDB.MSISDN == MSISDN 
and MSISDNProfileDB.column1 is null; 

...它仍然無法正常工作。但是,當我將列值更改爲1並執行此操作時:

from incomingStream#window.length(1) 
select correlation_MSISDN as MSISDN, 
     INTERACTION_DT as INTERACTION_DT 
update MSISDNProfileDB 
on MSISDNProfileDB.MSISDN == MSISDN 
and MSISDNProfileDB.column1 == '1'; 

它的工作原理!所以,結論是cep與oracle db的空值有問題。有誰知道如何處理空值?

親切的問候, 斯特凡

+0

嗨,你得到類似'org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException任何異常:錯誤同時更新數據庫事件,您的SQL語法錯誤; ... ',當你發送一個事件? – Grainier

+0

嗨Granier,當我嘗試使用此行更新...和MSISDNProfileDB.column1爲空...在碳日誌中有錯誤:「由...引起:java.sql.SQLSyntaxErrorException:ORA-00936:缺少表達式」 – StStojanovic

回答

1

我碰到類似的問題就來了與MySQL。這個問題似乎是CEP將Siddhi查詢解析爲SQL的方式。我爲此做了一個快速的fix,並且適用於我的場景。它應該也適用於你的情況,但還沒有通過Oracle測試過。使用修復程序(假設您使用的是CEP 4.2.0);

  1. 刪除siddhi-extension-event-table_3.1.2.jar<cep>/repository/components/plugins/目錄。

  2. compiled jar添加到<cep>/repository/components/lib/的模具。

  3. 使用以下查詢;

    from incomingStream 
    select 
        correlation_MSISDN as MSISDN, 
        INTERACTION_DT as INTERACTION_DT 
    update MSISDNProfileDB 
    on MSISDNProfileDB.MSISDN == MSISDN and not (MSISDNProfileDB.column1 is null); 
    
+0

感謝你Grainier爲你的支持!我正在使用CEP 4.1.0,我還可以在4.1.0版本上編譯這個jar嗎? – StStojanovic

+0

CEP 4.2.0使用Siddhi 3.1.2,CEP 4.1.0使用Siddhi 3.0.5。因此,您可能需要將更改應用到[v3.0.5 tag](https://github.com/wso2/siddhi/tree/v3.0.5)。這是[v3.0.5的補丁版](https://mega.nz/#!Qx8zRbTD!-_JySYc0KHT-pmRWGy31GX0rbF_hHIjv-eAs_SLwloE)。試試看看。 – Grainier

+0

現在一切正常。非常感謝你!親切的問候,斯蒂芬 – StStojanovic