Discussions
Categories
- 196.7K All Categories
- 2.2K Data
- 234 Big Data Appliance
- 1.9K Data Science
- 449.8K Databases
- 221.5K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 549 MySQL Community Space
- 477 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 532 SQLcl
- 4K SQL Developer Data Modeler
- 186.8K SQL & PL/SQL
- 21.2K SQL Developer
- 295.3K Development
- 17 Developer Projects
- 138 Programming Languages
- 292K Development Tools
- 104 DevOps
- 3.1K QA/Testing
- 645.9K Java
- 27 Java Learning Subscription
- 37K Database Connectivity
- 153 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 17 Java Essentials
- 157 Java 8 Questions
- 85.9K Java Programming
- 79 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.2K Java SE
- 13.8K Java Security
- 203 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 389 LiveLabs
- 37 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.6K Other Languages
- 2.3K Chinese
- 170 Deutsche Oracle Community
- 1K Español
- 1.9K Japanese
- 230 Portuguese
running a store procedure PL/SQL: ORA-01031:

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?
Best Answer
-
Hi, @francy77
In schema1 i granted
grant insert,update, delete on t_table_var to ico
Grant the SELECT privilege, as well as INSERT, UPDATE and DELETE.
It sounds like ico has the SELECT privilege only via a role. Roles don't count in AUTHID OWNER stored procedures; all the necessary privileges must be granted directly to the user, or to PUBLIC.
Also, does ico have the CREATE PROCEDURE system privilege?
EDIT: After reading @Paulzip 's reply (below) I added AUTHID OWNER above.
Answers
-
Hi, @francy77
In schema1 i granted
grant insert,update, delete on t_table_var to ico
Grant the SELECT privilege, as well as INSERT, UPDATE and DELETE.
It sounds like ico has the SELECT privilege only via a role. Roles don't count in AUTHID OWNER stored procedures; all the necessary privileges must be granted directly to the user, or to PUBLIC.
Also, does ico have the CREATE PROCEDURE system privilege?
EDIT: After reading @Paulzip 's reply (below) I added AUTHID OWNER above.
-
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
-
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;