2008-12-09

How to run a script with & sign in sqlplus?

Problem: we want to run a script in sqlplus that has a "&" sign that is not a variable placeholder.
Example: inserting a 'R&N' in a table or programing for the web, i.e. htp.p(' ')


Solution 1: Define off (no placeholder will be used)
sql> set define off
you can then set define on if you need to use the placeholder

Solution 2: change the placeholder (This allows to have also variable replacement)
sql> set define ^

Solution 3: define an escape character (This allows to have also variable replacement, but you need to change your code)
sql> set escape \
now every & sign that you want to use as a sign you must write \& (leaving it without the prior escape \ character will maintain the & as a placeholder)

No comments:

Post a Comment

Os comentários são moderados.
The comments are moderated.