Reputation: 855
INSERT INTO myTable (SELECT 2, mem_type_actor ('Phillip D'Onofrio ,Val Kilmer') FROM DUAL)
I want to insert into myTable these records but because of the quotes of D'Onofrio I get the error:
ORA-00907: missing right parenthesis
How can I fix it ?
I edit my question:
Infact I don't take records like that, I have these sql codes:
M_TERMS=Rocky,Carroll ; Chris,O'Donnell ; Daniela,Ruah ;
M_STR:=REPLACE(REPLACE(''''||M_TERMS||'''',',',' '),';',',');
M_SQL:='INSERT INTO myTable (SELECT '||M_ID||' , mem_type_actor ('||M_STR||') FROM DUAL)';
So when a record is like that O'Donnell , ORA-00907: missing right parenthesis occurs
Upvotes: 1
Views: 1670
Reputation: 347
There are two ways of using quotation marks in the oracle database 19c:
Q
(quotation) before the beginning of the string and !
at the start and end of the string.SELECT Q!' Today is my mother's birthday!' FROM DUAL;
'
'
) marks. This is just a workaround.SELECT 'Today is my mother''s birthday' FROM DUAL;
I hope this would have answered this question regarding quotation marks in the oracle database.
Upvotes: 0
Reputation: 154
Or use Oracle's q-quote operator: http://www.oracle-base.com/articles/10g/PlsqlEnhancements10g.php#quoting_mechanism_for_string_literals
Upvotes: 3
Reputation: 57583
You should use
INSERT INTO myTable
(SELECT 2, mem_type_actor ('Phillip D''Onofrio ,Val Kilmer') FROM DUAL)
using two single quotes in place of one inside string.
Upvotes: 4