ORA-01756: quoted string not properly terminated
A string literal has an opening single quote but no matching closing quote, usually because a quote inside the text wasn't doubled.
- Error code
ORA-01756- Category
- Syntax and SQL statements
What it means
Oracle reads a string literal from one single quote to the next. If the text contains an apostrophe, such as O'Brien, the literal ends early and the rest of the statement no longer parses; when no closing quote is found at all, Oracle raises ORA-01756.
Common causes
- An apostrophe inside a string that wasn't doubled:
'O'Brien'. - A missing closing quote at the end of a literal.
- Curly quotes pasted from a document, which Oracle doesn't treat as quotes.
- SQL built by concatenating user input into the statement text.
How to fix it
-
Double each single quote inside a literal.
INSERT INTO customers (last_name) VALUES ('O''Brien'); -
Or use Oracle's alternative quoting syntax, which lets the text contain single quotes as-is.
SELECT q'[It's O'Brien's order]' FROM dual;
-
In application code, pass values as bind variables instead of concatenating them into SQL. That also prevents SQL injection.
Related errors
ORA-00917missing commaORA-00911invalid character105SQL Server: Unclosed quotation mark after the string
More syntax and sql statements errors
ORA-00933SQL command not properly endedORA-00936missing expressionORA-00907missing right parenthesisORA-00918column ambiguously definedORA-00923FROM keyword not found where expectedORA-00937not a single-group group functionORA-00979not a GROUP BY expressionORA-01427single-row subquery returns more than one row
The code and message text are from the Oracle Database Error Help. Browse the full Oracle error list or search every database error.
Work on Oracle in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Oracle and the other databases you use.