Example with execute as Omitted

Create a procedure with references to an object with an unqualified name.

This is an example where the procedure has no execute as clause.
create procedure insert p  
    insert t1 (c1) values (100)
grant execute on insert p to bill

Bill executes the procedure:

exec jane.insert p

In the following example, Jane creates the same procedure as above with execute as owner:

create procedure insert p  
    with execute as owner as
    insert t1 (c1) values (100)
grant execute on insert p to bill

Bill executes the procedure:

exec jane.insert p

In the following example, Jane creates the same procedure as above with execute as caller:

create procedure insert p  
    with execute as caller as
    insert t1 (c1) values (100)
grant execute on insert p to bill

Bill executes the procedure:

exec jane.insert p