I have the following procedure:
CREATE or REPLACE PROCEDURE QUERY_EMP
(id IN emp.empno%TYPE, salario OUT emp.sal%TYPE, puesto OUT emp.job%TYPE)
IS
BEGIN
SELECT job, sal
INTO salario, puesto
FROM emp
WHERE empno = id;
END QUERY_EMP;
And by calling it in this way to prove it with this:
Declare
id emp.empno%TYPE := 7844;
salario emp.sal%TYPE;
puesto emp.job%TYPE;
BEGIN
QUERY_EMP(id, salario, puesto);
DBMS_OUTPUT.PUT_LINE(salario);
DBMS_OUTPUT.PUT_LINE(puesto);
END;
I get this error:
ORA-06502: PL / SQL: error: character to number conversion error numerical or value.
I do not understand why it jumps if the data type is the same and exists in the database.