Hello.

I have a procedure:

create or replace PROCEDURE find_area_pop( p_country_id wf_countries.country_id%TYPE := 0, p_country_name OUT wf_countries.country_name%TYPE, p_country_population OUT wf_countries.country_population%TYPE, p_country_square OUT wf_countries.country_square%TYPE ) IS BEGIN SELECT country_name, country_population, country_square INTO p_country_name, p_country_population, p_country_square FROM wf_countries WHERE country_id = p_country_id; EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE('Population of country at id = ' || p_country_id || ' not found'); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('Query returns population more than one country' || CHR(10) || 'or another error is occured!!!'); END; 

After the procedure has been created, I immediately run such an anonymous block:

 DECLARE v_country_name VARCHAR2(60); v_population NUMBER := 0; v_country_square NUMBER := 0; density NUMBER := 0; v_id wf_countries.country_id%TYPE; BEGIN find_area_pop( v_population, v_country_square, p_country_id => v_id, p_country_name => v_country_name ); IF(v_country_name IS NOT NULL) THEN BEGIN density := v_population/v_country_square; DBMS_OUTPUT.PUT_LINE('Country: ' || v_country_name ||', population: ' || v_population || ', total country density: ' || density); END; END IF; EXCEPTION WHEN ZERO_DIVIDE THEN DBMS_OUTPUT.PUT_LINE('Square of the country cannot be equal 0!!!'); END; Но в результате компиляции у меня появляется ошибка: ORA-06550: line 9, column 6: PLS-00703: multiple instances of named argument in list ORA-06550: line 9, column 6: PL/SQL: Statement ignored 

You will clearly say that I have an error in calling the find_area_pop procedure with a similar arrangement of parameters and tell me that I could not do so. But this is impossible. According to the task, I need this code to work and at the same time, when calling the procedure, the arrangement of parameters is the following: the first two parameters with positional notation (final values), and the last two with named notation (references to final values). How do I fix the code to make it work. Waiting for decisions.

Sincerely. Dima.

    1 answer 1

    Since the first two parameters are positional, the compiler assumes that it is p_country_id and p_country_name (this is how the function is declared). And then you pass them by name again, hence the error. The correct solution would be:

     find_area_pop( v_coutry_id, v_country_name, p_population => ..., p_country_square => ..., ); 
    • Thank you very much. I'll have to write it down)) - Minion Skywalker
    • Put then that is the right answer. :-) - hinotf