0

私が書いたこのSQLステートメントがあります。私が書こうとしているこのSQL文はpostgresにあります。オラクルに同じSQL文があり、正常に動作します。構文を読みましたが、問題ないようです。Oracle SQL ステートメントは次のようになります。

select to_char(calldate,'Day') as Day, 
       trunc(calldate) as transdate,
       decode(zoneorange,'-1, 'Onnet','0','Orange Uganda','1','UTL','2','MTN',3,'Airtel','4','Warid','5','MTN Fixed','Undefined') as destination

私が書いたpostgres sqlステートメントは次のようになります。

select to_char(calldate,'Day') as Day, 
       date_trunc('day',calldate) as transdate, 
      (case when zoneorange = '-1' 
         then 'Onnet'::text = '0'  
         then 'Orange Uganda' = '1' 
         then 'UTL' = '2' 
         then 'MTN' =3 
         then 'Airtel' = '4' 
         then 'Warid' = '5', 
         then 'MTN Fixed' 
         else 'Undefined' end) as destination

私のケースステートメントの構文エラーについて不平を言います。私には問題ないように見えるので、何が悪いのかわかりません。postgresql クエリで何が間違っている可能性がありますか。

4

1 に答える 1

4

ここには多くの構文エラーがあります。

試す :

select to_char(calldate,'Day') as Day, 
    date_trunc('day',calldate) as transdate, 
    (case zoneorange when '-1' then 'Onnet'
        when '0' then 'Orange Uganda'
        when '1' then 'UTL'
        when '2' then 'MTN'
        when '3' then 'Airtel'
        when '4' then 'Warid'
        when '5' then 'MTN Fixed'
        else 'Undefined' end) as destination
于 2013-01-16T16:16:02.947 に答える