ssbr
ssbr

Reputation: 1

insert special characters in oracle database

I want to insert the ampersand character '&' in oracle database

INSERT INTO EMPLOYEE(NAME, ADDRESS) VALUES ('XYZ', 'A & B');

While executing this query I see a popup and it asks me to enter value .

How can I enter special characters like & in the insert statement for oracle db?

Upvotes: 0

Views: 801

Answers (2)

Popeye
Popeye

Reputation: 35930

You can use CHR function as following:

INSERT INTO EMPLOYEE(NAME, ADDRESS) VALUES ('XYZ', 'A ' || CHR(38) || ' B');

38 is ascii value of &.

Cheers!!

Upvotes: 0

Justin Cave
Justin Cave

Reputation: 231801

In SQL*Plus or SQL Developer

set define off

to let the client know that you don't want it to interpret the ampersand character as the beginning of a substitution variable.

Upvotes: 1

Related Questions