user460111
user460111

Reputation: 13

How to enter special characters like “§” in oracle database?

I want to insert special character § in my INSERT statement.

My insert is:

INSERT INTO STUDENT(name, class_id) VALUES ('Samantha', 'Java_22 & Oracle_14');

If I try to run this query than am getting popup and it ask me to enter value for Oracle_14, so my question is how can I enter special characters like § in the INSERT statement for oracle db ?

Upvotes: 1

Views: 3785

Answers (2)

The '&' character is the default macro definition character is SQL*Plus. If you're using SQL*Plus to execute your queries there are two ways to work around this:

  1. Use the SET DEFINE OFF command to turn off macro definition altogether, or
  2. Use SET DEFINE <some_other_character> to change the macro definition character; e.g. you could issue SET DEFINE ^ to change the macro definition character to '^' for the duration of your current session.

The other option I can think of would be to use the CHR function to avoid the need to type in a & character. CHR(38) is the equivalent of the & character, so if you used

'Java_22 ' || CHR(38) || ' Oracle_14'

you'd get the same result with no & in there to be misinterpreted by SQL*Plus.

Share and enjoy.

Upvotes: 3

VB.NET LEARNER
VB.NET LEARNER

Reputation: 711

Try 'Java_22 '||'&'||' Oracle_14'

Upvotes: 1

Related Questions