DEFINE
Example
Section titled “Example”DEFINE customer_id = 10;SELECT * FROM customers WHERE id = &customer_id;UNDEFINE customer_id;Output
Section titled “Output”| id | first_name | last_name | |
|---|---|---|---|
| 10 | John | Doe | john.doe@example.com |
Explanation
Section titled “Explanation”In the example, the DEFINE command is used to create a substitution variable named customer_id with a value of 10. This substitution variable is then referenced in the SELECT statement using an ampersand & just before the variable name to retrieve the customer record with id 10. The UNDEFINE statement at the end removes the substitution variable.