【隨手記】Oracle存儲過程報錯

Compilation errors for PACKAGE BODY

Error: PLS-00382: 表達式類型錯誤
 

存儲過程啓動時報錯如下,看到這個首先想到的是類型不匹配,但是一直沒找到可能出現的問題,

 

然後。。。。

hmw_org_code     VARCHAR2(128);

for dept_code in (select distinct hme1.dept_id
                         from xxx hme1
                         where 1=1) loop

hmw_org_code :=  dept_code

 

 

嗯。。。。這樣dept_code其實是個對象。。。所以使用它直接給一個變量賦值的時候會報錯;於是改成了下面這樣,即使用對象變量進行賦值就解決問題了。

for dept_code in (select distinct hme1.dept_id dept_id
                         from xxx hme1 
                         where 1=1)

mw_org_code :=  dept_code.dept_id

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章