// Oracle error reference

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
Error message
quoted string not properly terminated

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

  1. Double each single quote inside a literal.

    INSERT INTO customers (last_name) VALUES ('O''Brien');
  2. 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;
  3. In application code, pass values as bind variables instead of concatenating them into SQL. That also prevents SQL injection.

Related errors

More syntax and sql statements errors

The code and message text are from the Oracle Database Error Help. Browse the full Oracle error list or search every database error.

// fewer errors, faster fixes

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.