Please assume:
User A
creates global temporary table gtt
.
User A
creates stored procedure sp
with definer's rights AUTHID DEFINER
. For simplicity, assume this sp
simply inserts a row into gtt
and selects a value from the row in gtt
.
User A
grants user B
execute
on sp
.
What additional grants, if any, need to be given to users A
and B
so that B
can successfully execute sp
?
I've heard that when a global temporary table is used (e.g. data inserted), that the user using the global temporary table needs create table
privilege to create the instance of the globaly temporary table in their session's memory (even though the global temporary table itself was already created). Is that true? I assumed granting select and insert on the global temporary table would have been sufficient.
Because sp
is defined by A
does this mean A
needs create any table
, so the row of data can be inserted and selected from user B
's session memory?
Sorry, I don't currently have access to an Oracle instance where I have enough privileges to try this myself.
Please note, I am not trying to create the global temporary table in the stored procedure.
Using Oracle 19c Enterprise Edition.
Thank you in advance for helping me understand the privileges involved here.
None.
Everything works so far for the
GTT
andSP
owner. Let's see the grantee.Right; as I said, no other privileges are needed - stored procedure works (i.e. didn't fail), but - as
scott
didn't grant any additional privileges,mike
can't checkgtt
table's contents.Back to
scott
:But of course; that's a global temporary table -
scott
sees only its own data (which is now lost).[EDIT: to answer questions you posted as comments]
mike
hadcreate table
privilege; now it doesn't:This piece of code is a copy/paste from above:
Additionally,
scott
now grantsselect
ongtt
tomike
:What does
mike
see now?