3 Replies Latest reply: Sep 30, 2011 10:49 AM by 888591 RSS

    Substitution Variables in SQLPLUS

    880836
      I need to find a efficient way to substitute the viable in "one shot".

      The scripts looks like following:

      GRANT SELECT, INSERT, UPDATE, DELETE ON table1 TO &TARGET_USER;
      GRANT SELECT, INSERT, UPDATE, DELETE ON table2 TO &TARGET_USER;
      GRANT SELECT, INSERT, UPDATE, DELETE ON table3 TO &TARGET_USER;
      GRANT SELECT, INSERT, UPDATE, DELETE ON table4 TO &TARGET_USER;
      GRANT SELECT, INSERT, UPDATE, DELETE ON table5 TO &TARGET_USER;
      ...
      +GRANT SELECT, INSERT, UPDATE, DELETE ON table200 TO &TARGET_USER;+

      The &target_user is changing when this script is promoting to different environment and I do not know the target_user name during my development.

      the problem of current script is I have to enter 200 times for the value of target_user, is there anyway I can only enter once and sqlplus will replace the same variables itself?


      appreciate your help.

      Edited by: user10604189 on 28-Sep-2011 13:23

      Edited by: user10604189 on 28-Sep-2011 13:23