Forum Stats

  • 3,768,302 Users
  • 2,252,772 Discussions
  • 7,874,521 Comments

Discussions

running a store procedure PL/SQL: ORA-01031:

francy77
francy77 Member Posts: 260 Bronze Badge

Hi all,

I'm trying to select records from a table, using a store procedure, but I get:

  • Errore(13,10): PL/SQL: ORA-01031: privilegi insufficienti 

at Line 13 there is :

select k_id into id from schema1.t_table_var where k_id=12;


In schema1 i granted

grant insert,update, delete on t_table_var to ico


and if I try to run the query directly (non in a pl/sql procedure) I can get the results; Besides if i try to make a select to another table but in the schema schema1) I can get the result....... I'm getting crazy;


So what I have to do in order to use a table inside a different schema, in a pl/sql procedure?

Tagged:

Best Answer

Answers

  • Paulzip
    Paulzip Member Posts: 8,489 Blue Diamond
    edited Feb 1, 2021 7:46PM

    You need the select privilege too,

    Also, another thing to bear in mind, is the procedure defined with definer rights (permissions are based on who owns the procedure) or invoker rights (permissions are based on who is calling the procedure)?

    The default is definer rights.

    Example of invoker rights....

    create or replace procedure update_par(pcod in varchar2) authid current_user is 
    
    Frank Kulashfrancy77
  • francy77
    francy77 Member Posts: 260 Bronze Badge

    I don t know why but granting select was enought, as your suggestion there was a missing SELECT in the grant instruction, so I added it and it works;

    The strange thing is that indeed without the select even the delete dos't worked;