Thursday, April 10, 2014

How to insert an ambersand '&' into database

When ever you try to insert an ambersand '&' into database, database tries to intract and get the values values from screen. in that case we can follow below steps

create table test (name varchar2(35));
insert into test values ('hello&world');

I tried the escape character '\' but the system asks for a value of the substitution variable.

Solution:


set define off
create table test (name varchar2(35));
insert into test values ('hello&world');


press 'F5' to execute the above commands.
 
(OR) 
 
 
insert into table1 values('&'||'hello world');

1 row created.

select * from table1;

COL1
--------------------------
&hello world

No comments:

Post a Comment