I'm trying to create a temporary table in a procedure:
PROCEDURE pr_create_tmp_bp_table(fp_id NUMBER) IS
tbl_name CONSTANT VARCHAR2(20) := 'BP_TO_DELETE';
BEGIN
-- sanity checks removed for readablity
EXECUTE IMMEDIATE
'CREATE GLOBAL TEMPORARY TABLE ' || tbl_name || ' ' ||
'ON COMMIT PRESERVE ROWS AS ' ||
'SELECT * FROM infop_stammdaten.bp';
END;
If I copy the BEGIN.._END block to a SQL worksheet everything works fine. So I think the user has the right to create a temporary table. If I execute the procedure from the same SQL worksheet I get
Fehlerbericht -
ORA-01031: Nicht ausreichende Berechtigungen
ORA-06512: in "INFOP_STAMMDATEN.PA_DELETE_FP", Zeile 16
ORA-06512: in Zeile 6
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without
the necessary privileges.
*Action: Ask your database administrator or designated security
administrator to grant you the necessary privileges
Line 16 (Zeile 16) point to the EXECUTE IMMEDIATE statment that creates the temporary table.
To me this look like the user does not have the same rights in the sql work sheet and when it executes a procedure, also the procedure is in it's own schema.
INFOP_STAMMDATEN.PA_DELETE_FP- is that the package that contains the procedurepr_create_tmp_bp_table? 4. The most important - does your user haveCRATE TABLEprivilege?