Execute procedure oracle

4

I created this procedure but I can not execute it. I have the following error when trying Execute:

  

PLS-00306: Incorrect number of argument types in call to 'SP_CARTAO'

CREATE OR REPLACE PROCEDURE SP_CARTAO
(
   P_ID IN INT ,
   P_ID_CARTAO OUT INT
)
AS
BEGIN
  SELECT ID_CARTAO INTO P_ID_CARTAO
  from log_cartao
  where log_cartao.id_cartao = P_ID;
END;

EXECUTE SP_CARTAO(1);
    
asked by anonymous 01.12.2014 / 22:14

1 answer

5

The procedure expects 2 parameters but you are only passing one parameter to it.

To pass an output parameter to an Oracle stored procedure, you can do this:

declare
P_ID_CARTAO number;
begin
EXECUTE SP_CARTAO(1, P_ID_CARTAO);
-- aqui, a variável P_ID_CARTAO terá o valor que foi setado pela stored procedure
end;
    
01.12.2014 / 22:37