Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

Recently I've had to run a fairly large .sql file that installed a PL/SQL package. There were a number of ampersand (&) characters used throughout the file which were not meant for use as substitution values but SQLDeveloper was still tricked into asking for a substitute to be entered. Luckily, there was an easy way to stop this from happening.

As a simple example if I try to run a SQL statement - "select 'Apples & Banans' as fruit from dual;", SQLDeveloper will do this...
sqldevdefine_1.png


Not really what is wanted! SQLDeveloper understands the SET DEFINE command as used in SQLPlus. So setting this value to OFF will disable value substitution. Easy!
sqldevdefine_2.png


The command is run like a normal SQL statement, After that, no more substitution is performed, the prompts go away and the ampersands behave as regular characters. This is only needed to be run once for a session too, so no need to keep running it as long as you're using the same connection/session.
sqldevdefine_3.png




-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.