Problems when creating SP in Oracle

0

Good morning, I have a problem creating a stored procedure in Oracle and trying to save it tells me that I do not have privileges for the table to which I refer, but if I create the SP if I run the slect directly if it brings me records but within the stored procedure it tells me that I do not have permissions.

  

Eye: I've already done stored procedure with other tables and if it leaves me   create them.

     

Error (6,1): PL / SQL: SQL Statement ignored

     

Error (6,30): PL / SQL: ORA-01031: insufficient privileges

create or replace procedure  sp_tbl_tmp_reger_adeudos
(p_cursor out SYS_REFCURSOR)
as
begin 
open p_cursor for
select  EXPEDIENTE  from sys.tbl_tmp_reger_adeudos;
end;

Greetings.

    
asked by andres martinez 20.09.2018 в 01:11
source

2 answers

0

You must give select permissions on the table you are using in the procedure to the owner of the procedure.

    
answered by 20.09.2018 в 06:59
0

Although it seems strange it is necessary to assign permission to select the table to your user. You must do this from another database user who has permission to grant grants.

From that user it is necessary to do:

grant select on sys.tbl_tmp_reger_adeudos to TU_USUARIO;
    
answered by 20.09.2018 в 07:55