Ora-00932:inconsistent datatypes:expected number got CHAR
00932.00000-"Inconsistent datatypes:expected%s got%s"
1 Case 2when '0'then NVL (tx_cnt,0 )3 ELSE4END act_tx_cnt,
TX_CNT is number type, which is the count after group by
TOT_TX_CNT is VARCHAR2 (XX) type
Therefore, the above error message appears.
Solution: Transform data to convert Number data to VACHAR2 (XX) type
1 Case 2when'0'thenCAST(NVL (act_tx_cnt,0 asVARCHAR2(83ELSE4 END act_tx_cnt,
Finish
The complete code is a small note:
The number of trades, the amount of the transaction, the number of valid trades, the amount of the transaction in the statistics file.
1 SELECTEpstfbok. File_dt,2 Epstfbok. File_type,3 Epstfbok. FILE_SRC,4 epstfbok.fil_sts,5 Epstfbok. Rcv_fil,6 Epstfbok. TOT_TX_CNT,7 Epstfbok. Tot_tx_amt,8 Epstfbok. RMK,9 Epstfbok. Bat_no,TenNVL (chui_cnt,0) chui_cnt, One CaseEpstfbok. File_type when '0' Then CAST(NVL (ACT_TX_CNT,0) as VARCHAR2(8))ELSEEpstfbok. Tot_tx_cntENDact_tx_cnt, A CaseEpstfbok. File_type when '0' Then CAST(NVL (Act_tx_amt,0) as VARCHAR( the))ELSEEpstfbok. Tot_tx_amtENDAct_tx_amt - fromEpstfbok - Left JOIN the(SELECTBat_no,COUNT(*) chui_cnt fromEpstordrWHEREAlt_flg='1' GROUP bybat_no) -M onEpstfbok.bat_no=M.bat_no - Left JOIN -(SELECTBat_no,COUNT(*) act_tx_cnt,SUM(Tx_amt) Act_tx_amt fromEpstordrGROUP bybat_no) +N onEpstfbok.bat_no=N.bat_no - ORDER byEpstfbok. Bat_nodesc;
[SQL] Inconsistent data type of data in different cases in case statement ora-00932:inconsistent datatypes:expected number got CHAR