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
GTTandSPowner. Let's see the grantee.Right; as I said, no other privileges are needed - stored procedure works (i.e. didn't fail), but - as
scottdidn't grant any additional privileges,mikecan't checkgtttable's contents.Back to
scott:But of course; that's a global temporary table -
scottsees only its own data (which is now lost).[EDIT: to answer questions you posted as comments]
mikehadcreate tableprivilege; now it doesn't:This piece of code is a copy/paste from above:
Additionally,
scottnow grantsselectongtttomike:What does
mikesee now?