Could not create catalog object: insufficient privilege; Not authorized
When I tried to create HANA database repository procedure (HDB procedure) .hdbprocedure using SAP HANA Web-based Development Workbench Editor, I got following activation error: Could not create catalog object: insufficient privilege; Not authorized
Here is a simple HANA database procedure I created for test on my trial account database schema on hanatrial.ondemand.com portal
Above HANA procedure created via .hdbprocedure file within a package named kodyaz
SQLScript developers can realize the only part is the SELECT statement that could cause following activation error.
File /kodyaz/HDBProcedure04.hdbprocedure saved successfully.
Error while activating /kodyaz/HDBProcedure04.hdbprocedure:
[kodyaz:HDBProcedure04.hdbprocedure] Could not create catalog object: insufficient privilege; Not authorized
If you experience such a problem, remember that such repository procedures (.hdbprocedure) are created as "_SYS_REPO" although you won't be able see this procedure under _SYS_REPO schema. So this "insufficient privilege; Not authorized" erro shows that _SYS_REPO does not have the authorization to execute SELECT statement as required for this sample HANA procedure.
For the solution, I launched Security view on SAP HANA Web-based Development Workbench
Then you can grant SELECT permission on all objects created under KODYAZ schema within Object Privileges tab for _SYS_REPO user
By granting SELECT permissions on objects within a certain schema, _SYS_REPO user will be able to read all data on related database schema.
Database administrators can limit the SELECT permission on table level selecting the target table only instead of granting SELECT access to all schema objects.
Right after granting SELECT access, SQLScript developers can try to create the same HDB procedure and will get following success message.
File /kodyaz/HDBProcedure04.hdbprocedure saved & activated successfully.