Difference between SET SCAN & SET DEFINE

3.7k views Asked by At

Why do in SQL*PLUS we have SET SCAN and SET DEFINE both ? I know both are used interchangeably in SQL. I tested and found that if i set any of them OFF, substitution variables will not work. Is their any specific case where we need both and importance of both can be understood simultaneously?

Thanks in advance.

1

There are 1 answers

0
Alex Poole On BEST ANSWER

SET DEFINE is more flexible as it lets you change the substitution character from & to something else, whereas SET SCAN can only be turned on or off.

Probably more importantly, SET SCAN is obsolete; from the documentation:

Obsolete commands are available in current releases of SQL*Plus. In future releases, they may only be available by setting the SQLPLUSCOMPATIBILITY variable. You should modify scripts using obsolete commands to use the alternative commands.

So both work for now, but I wouldn't use SET SCAN in any new code.