2014-04-17 28 views
1

的內部存儲過程我有這樣的過程:不能調用其他程序

PROCEDURE insert_change_history(
    client_number_l   history.client_number%TYPE, 
    change_date_l    history.change_date%TYPE, 
    field_name_l    history.field_name%TYPE, 
    new_value_l    history.new_value%TYPE, 
    action_performer_l  history.action_performer%TYPE 

) AS 

    old_value_l    history.old_value%TYPE; 

    BEGIN 

    SELECT new_value into old_value_l from history; 

    IF old_value_l = new_value_l THEN CALL load_client_numbers(); 

    END IF 

END insert_change_history; 

正如你可以看到我試圖打電話load_client_numbers() if語句裏面,但它不工作。我收到以下錯誤:

Error(4017,44): PLS-00103: Encountered the symbol "LOAD_CLIENT_NUMBERS" when expecting one of the following:  := . (@ % ; The symbol ":=" was substituted for "LOAD_CLIENT_NUMBERS" to continue. 
Error(4022,1): PLS-00103: Encountered the symbol "END" when expecting one of the following:  ; The symbol ";" was substituted for "END" to continue. 

這裏是load_client_numbers()

PROCEDURE load_client_numbers(
result_o     OUT CLOB 
) AS 
    l_data          hub_cursor; 

    number_l   plan.client_number%TYPE; 
    name_l    details.client_name%TYPE; 

    l_jsonArray   json_list; 
    l_jsonObj    json; 
    l_obj_out    json; 
    BEGIN 
    OPEN l_data FOR 

    SELECT DISTINCT rp.number, cd.name 
    FROM plan rp 
    FULL JOIN details cd ON rp.number = cd.number 
    ORDER BY number; 

    l_jsonArray := json_list(); 

    LOOP 
     FETCH l_data INTO 
     number_l, name_l; 
    EXIT WHEN l_data%NOTFOUND; 

     l_jsonObj := json(); 
     l_jsonObj.put('Number', number_l || '/' || client_name_l); 
    -- l_jsonObj.put('Name', name_l); 

     l_jsonArray.append(l_jsonObj.to_json_value); 

    END LOOP; 
    CLOSE l_data; 

    l_obj_out := json(); 
    l_obj_out.put('data',l_jsonArray);  
    result_o := ' '; 
    l_obj_out.to_clob(result_o); 

END load_client_numbers; 

爲什麼會出現錯誤?我知道我錯過了一些非常小的東西,但我無法發現它,因爲我不是Oracle中的專家。

回答

4

的代碼應該像

IF old_value_l = new_value_l THEN load_client_numbers(param); 
END IF; 

(無CALL) 其中param是CLOB。

+0

哇。巨大的感謝!有效!!!我會在9分鐘內接受你的答案,因爲我現在不允許這樣做。再次感謝!!! – Slim