Din Din - 8 days ago 6
SQL Question

how to insert a value with embedded single quotes in Oracle

How to insert the following ENTIRE string to a varchar2(31) field.

u1salcd||' '||dmname


I get the following error message.

INSERT INTO EXPORTS_DEFS ( EXPORT_ID, EXPORT_ID2 ) VALUES ('ucsalcd||' '||dmname','L');
Error at Command Line:1 Column:71
Error report:
SQL Error: ORA-00917: missing comma
00917. 00000 - "missing comma"
*Cause:
*Action:

Answer

Please try:

INSERT INTO EXPORTS_DEFS ( EXPORT_ID, EXPORT_ID2  ) 
VALUES ('ucsalcd||'' ''||dmname','L');