Home » RDBMS Server » Server Administration » how to enter 'a&b' in varchar field?
how to enter 'a&b' in varchar field? [message #115153] Thu, 07 April 2005 14:32 Go to next message
win_vj
Messages: 16
Registered: March 2005
Location: India
Junior Member
Hi All,

I have a table which contains a varchar field. I have to enter a value in that field let say 'a&b', But oracle is taking it as a variable and asks to enter value for '&b'.

SQL> desc test1
Name Null? Type
----------------------------------------- -------- ------------
FNAME VARCHAR2(10)
LNAME VARCHAR2(10)
AGE NUMBER(3)

SQL> Insert into test1(FNAME,LNAME,AGE) values('a&b','b&a',20);

How can i enter a&b in these fields?

Thanks in Advance!
WIN
Re: how to enter 'a&b' in varchar field? [message #115154 is a reply to message #115153] Thu, 07 April 2005 14:41 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
mag@mutation_mutation > set escape '/'
 mag@mutation_mutation > insert into tableA values ('A/&B')
  2  /

1 row created.

mag@mutation_mutation > select * from tableA;

C
----------
A&B

Re: how to enter 'a&b' in varchar field? [message #115156 is a reply to message #115154] Thu, 07 April 2005 15:06 Go to previous messageGo to next message
win_vj
Messages: 16
Registered: March 2005
Location: India
Junior Member
Thanks a Ton!

but can you please tell me how to select that value?

select * from test1 where fname='a/&b';

Thanks
WIN
Re: how to enter 'a&b' in varchar field? [message #115157 is a reply to message #115156] Thu, 07 April 2005 15:35 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
same method.

mag@mutation_mutation > set escape '/';
mag@mutation_mutation > select * from tableA where c='A/&B';

C
----------
A&B

Re: how to enter 'a&b' in varchar field? [message #117588 is a reply to message #115156] Thu, 28 April 2005 06:54 Go to previous message
d.c.b.a
Messages: 44
Registered: March 2005
Location: China
Member

set define ~


set define to a char does not appear in the value.

[Updated on: Thu, 28 April 2005 06:55]

Report message to a moderator

Previous Topic: How asp.net to visit oracle 9i in one server?
Next Topic: Creating DB instance on Unix machine remotly
Goto Forum:
  


Current Time: Sun Jan 26 04:36:40 CST 2025