Welcome Guest. Sign in or Signup

1 Answers

Substitution Variable in SQR

Asked by: 4051 views SQR

SQR has a special set of variables called Substitution Variables. What are they used for? Can you state the syntax of using them in a SQR program? What advantages do they have?

Related Questions

1 Answers



  1. JT on Jan 25, 2013 Reply

    Substitution variables are preprocessor or compile time variables. They are more flexible than run time variables because they can replace part of a command not just a literal value.
    Here is an example:

    #define num 1
    #define table EMP
    #define clause1 and EFFDT = ’01-JAN-2013′

    begin-setup
    ask empid ‘enter emp id ‘
    end-setup

    begin-program
    begin-sql
    update {table}
    set SERIAL = {num}
    where EMP_ID = {empid}
    {clause1}
    end-sql
    end-program
    =================================================
    Here is the SQL statement formed by the compiler

    update EMP
    set SERIAL = 1
    where EMP_ID = ‘123’
    and EFFDT = ’01-JAN-2013′

    +3 Votes Thumb up 0 Votes Thumb down 0 Votes


Answer Question