Question

I have this procedure:

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;

As you can see I'm trying to call load_client_numbers() inside of the if statement, but it is not working. I'm getting the following errors:

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. 

Here is the 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;

Why am I getting the errors? I know that I'm missing something really small, but I'm not able to spot it, as I'm not a pro in Oracle.

Was it helpful?

Solution

The code should be like

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

(no CALL) where param is a clob.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top