Search code examples
t-sqlplsqlsqlplussqlcmd

Translate PL/SQL define to TSQL


I am given a task to transition PL/SQL code to T-SQL.

Can anybody explain what SET DEFINE ON does in sqlplus and most impooirtantly how to translate it to T-SQL (I suppose using sqlcmd as a launcher?)


Solution

  • SET DEFINE is an SQL*Plus command setting the use and prefix for substitution variables. & is the default prefix and SET DEFINE ON resets it to this default and turns on the use of substitution variables.

    So this is not a PL/SQL thing but an SQL*Plus thing.

    As far as I know there's no such thing as substitution variables for sqlcmd, i.e. there's no equivalent for sqlcmd let alone T-SQL. But I might be wrong there.