pb中sql语句用to_char查询出来数据,居然无法检索出数据,oracle数据库,这是什么原因?

1 /*这样dw_modified总是无法检索出正确的结果*/
2 select nvl(max(to_char(SBLJL01,'000')),'000') 
3   into :is_recoder_old_sn 
4   from emra03 
5  where szybh01 = :as_pat_id
6    and Swdfl01 = :as_emr_code;    
7 
8 Integer li_ret
9 li_ret = dw_modified.retrieve(as_pat_id,as_emr_code,is_recoder_old_sn)
1 /*这样就没事,能得出结果*/
2 select max(SBLJL01)
3 into :is_recoder_old_sn 
4 from emra03 
5 where szybh01 = :as_pat_id
6 and Swdfl01 = :as_emr_code;    
7 
8 Integer li_ret
9 li_ret = dw_modified.retrieve(as_pat_id,as_emr_code,is_recoder_old_sn)
 1 /*这样也没问题*/
 2 Long ll_recoder_old_sn  
 3 select max(to_number(SBLJL01))
 4   into :ll_recoder_old_sn  
 5   from emra03 
 6  where szybh01 = :as_pat_id
 7    and Swdfl01 = :as_emr_code;
 8     
 9 is_recoder_old_sn = String(ll_recoder_old_sn,"000")
10 
11 Integer li_ret
12 li_ret = dw_modified.retrieve(as_pat_id,as_emr_code,is_recoder_old_sn)

可是两个select 语句的结果都是023,奇怪不?

posted @ 2014-06-04 17:36  春夏秋冬春  阅读(672)  评论(0编辑  收藏  举报