Calling a saved PROCEDURE in a toad

I have a certain new stored procedure, but when you call it, you get an error,

CREATE OR REPLACE PROCEDURE SCOTT.getempsal( p_emp_id IN NUMBER, p_emp_month IN CHAR, p_emp_sal OUT INTEGER) AS BEGIN SELECT EMP_SAL INTO p_emp_sal FROM EMPLOYEE_SAL WHERE EMP_ID = p_emp_id AND EMP_MONTH = p_emp_month; END getempsal; 

And trying to call it:

 getempsal(1,'JAN',OUT) --Invalid sql statement. 
+7
source share
1 answer

Your procedure contains an out parameter, so you need to call it in a block, for example:

 declare a number; begin getempsal(1,'JAN',a); dbms_output.put_line(a); end; 

A simple procedure (for example, using a numerical parameter) can be called with

 exec proc(1); 

or

 begin proc(1); end; 
+14
source

All Articles