Reputation: 13
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
Reputation: 50047
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:
SET DEFINE OFF
command to turn off macro definition altogether, orSET 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