Understanding AUTHID CURRENT_USER in Oracle PL/SQL – Step by Step with Examples
1. What is AUTHID in PL/SQL?
In Oracle PL/SQL, a package, procedure, or function can run under two modes:
- AUTHID DEFINER (default): Code runs with the privileges of the schema that owns the object.
- AUTHID CURRENT_USER: Code runs with the privileges of the user who is calling the object.
If you don’t explicitly mention AUTHID, Oracle assumes AUTHID DEFINER.
2. Why AUTHID CURRENT_USER Matters
- Useful in multi-schema applications where you want to allow different users to call the same code without creating synonyms everywhere.
- Forces Oracle to check privileges of the invoker, not just the owner.
- Can cause ORA-01031: insufficient privileges if the calling user does not have required grants.
3. Example 1 – Default Behavior (AUTHID DEFINER)
- emp_pkg runs as HR (the owner).
- If another user APPUSER executes emp_pkg.get_emp, they do not need direct SELECT on employees table.
- Because privileges of HR are used.
4. Example 2 – AUTHID CURRENT_USER
- Now, when APPUSER calls emp_pkg.get_emp, the query runs with APPUSER’s privileges.
- If APPUSER does not have SELECT on HR.employees, they get ORA-01031 insufficient privileges.
- To fix, grant the privilege:
5. Example 3 – With Synonym
But with AUTHID CURRENT_USER, the privileges still must exist for APPUSER. The synonym only simplifies object reference; it does not provide privileges.
6. Common Issues
- Why does it work in one DB and not another?
In another DB, grants are missing.
- Why synonyms don’t solve it?
- Why does Oracle sometimes add AUTHID CURRENT_USER?
7. Key Takeaways
- AUTHID DEFINER (default) = runs as owner.
- AUTHID CURRENT_USER = runs as caller (invoker).
- Synonyms help with object names, not privileges.
- Always check which user needs which grant when AUTHID CURRENT_USER is used.

7 Comments
Beyond the promos, the collection usually includes several booster packs from recent expansions, giving buyers a chance to expand their decks or hunt for rare pulls. These packs not only enhance the value of the box but also give players a fun opening experience, mixing both nostalgia and excitement. Pulling a rare card alongside the guaranteed promos can make this collection especially rewarding.
ReplyDeleteLove the shirt’s artwork, but disappointed by the price vs durability. After a few washes, the seams started to fray a bit, and one of the printed flowers has begun to crack.
ReplyDeleteJoggers are no longer just gym wear; they’re now a lifestyle essential. Kroen joggers offer a modern fit that works well for travel, errands, or casual outings. Their Christmas sale is ideal for gifting or personal use.
ReplyDeleteChristmas shopping is not just about discounts but also about finding value. HMDD Clothing offers apparel that blends comfort with modern aesthetics. Their seasonal sale looks like a great opportunity to invest in long-lasting fashion.
ReplyDeleteInformational content like this helps businesses understand the importance of branding during Christmas promotions. ktwo studios demonstrates how consistency in visuals builds long-term trust. Great insights here for anyone planning holiday campaigns.
ReplyDeleteNot all sales align with brand values. Some platforms dilute identity during promotions. The denim tears official site maintains its philosophy while offering sales access.
ReplyDeleteBernes Shoes are perfect for festive fashion this season. Many people love their unique design and comfort. Holiday sales make them affordable for everyone. You can explore different styles and colors. Bernes Shoes always stand out in quality and style.
ReplyDeletePost a Comment