Skip to main content
Question

GRANT inside for Loop

  • February 20, 2022
  • 3 replies
  • 112 views

Forum|alt.badge.img+3

Hi All,

 

I want to give  grant permission to tables which are more in number.

 

I have executed below logic , it is throwing below error “Encountered the symbol “GRANT” when expecting below “ 

Code used :

 

DECLARE

BEGIN

FOR R IN (SELECT TABLE_NAME FROM IC_TAB_LIST)

LOOP

    GRANT SELECT ON R.TABLE_NAME TO IFSAPP

END LOOP;

END

 

Here : IC_TAB_LIST = Table name, which has around 300 tables where i need to give permission.

 

Please suggest asap.

This topic has been closed for replies.

Forum|alt.badge.img+9
  • Hero (Employee)
  • February 21, 2022

Hi @TechSriniG 

This May Helpful

 

DECLARE

BEGIN

FOR R IN (SELECT TABLE_NAME FROM IC_TAB_LIST)

LOOP

   EXECUTE IMMEDIATE 'GRANT SELECT ON '||R.TABLE_NAME||' TO IFSAPP';

END LOOP;

END


Forum|alt.badge.img+3
  • Do Gooder (Partner)
  • February 21, 2022

Thank you Shaan, its working


Forum|alt.badge.img+9
  • Hero (Employee)
  • February 21, 2022

Hi @TechSriniG 

Happy to hear the issue was resolved. You can mark this question as solved now :).

Thanks & Regards
Shan


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings