Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the "&" on insert as a string 2

Status
Not open for further replies.

jestrada101

Technical User
Joined
Mar 28, 2003
Messages
332
I used SET SCAN OFF

Is it safe to use this to allow sql to use the & in a string?

Thanks!
JE
 
Actually, a more specific method involves the SQL*Plus variable, "DEFINE". You can confirm the default contents of this variable with:
Code:
SQL> show define
define "&" (hex 26)
SQL> select 'Fine & Dandy' from dual;
Enter value for dandy: Tuning
old   1: select 'Fine & Dandy' from dual
new   1: select 'Fine Tuning' from dual

'FINETUNING
-----------
Fine Tuning
You can then turn it off with:
Code:
SQL> set define off
SQL> show define
define OFF

SQL> select 'Fine & Dandy' from dual;

'FINE&DANDY'
------------
Fine & Dandy

You can also re-assign any non alpha-numeric character you want to be the prompt character:
Code:
SQL> set define !
SQL> select 'Bang! Went the explosives' from dual;
Enter value for went: Sounded
old   1: select 'Bang! Went the explosives' from dual
new   1: select 'BangSounded the explosives' from dual

'BANGSOUNDEDTHEEXPLOSIVES'
--------------------------
BangSounded the explosives

Does this cover things?

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
Thanks Mufasa.. I think you've covered it all!

JE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top