
Answer-first summary for fast verification
Answer: When the stored procedure needs to run with the privileges of the role that called the stored procedure
The correct answer is C because stored procedures created with `EXECUTE AS CALLER` run with the privileges of the role that called the stored procedure, not the owner's privileges. This is the fundamental purpose of caller's rights stored procedures in Snowflake. Option A is incorrect because caller's rights doesn't prevent viewing source code - that's handled through other mechanisms. Option B is vague and not a specific reason for using caller's rights. Option D is actually the opposite scenario - when a stored procedure needs to operate on objects the caller doesn't have privileges on, it should be created with owner's rights (EXECUTE AS OWNER), not caller's rights. The community discussion shows 100% consensus on answer C with upvoted comments referencing official Snowflake documentation.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
Under what circumstances should a stored procedure be created with EXECUTE AS CALLER?
A
When the caller needs to be prevented from viewing the source code of the stored procedure
B
When the caller needs to run a statement that could not execute outside of the stored procedure
C
When the stored procedure needs to run with the privileges of the role that called the stored procedure
D
When the stored procedure needs to operate on objects that the caller does not have privileges on
No comments yet.