Home » questions » Using Oracle, how do I insert a text field with an embedded ';' value.?

Using Oracle, how do I insert a text field with an embedded ';' value.?

2006-08-07 11:39:26, Category: Programming & Design
I have a table with several text fields. I am trying to insert text in one of those fields that includes new lines and a semicolon ';'. SQLPLUS interprets the the semicolon as the end of the command, and reports an error: SQL> insert into mytable values (' field; ', 'field2'); ORA-01756: quoted string not properly terminated. Escaping with field'';'' eliminates the error, but leaves the value as "field';'", which is not what I want. Escaping with '\' does not help. How do I escape a semicolon at the end of a line of multiline text input?

Answers

  1. Darth Vader

    On 2006-08-08 15:11:07


    see http://www.oracle.com/technology/support/tech/sql_plus/htdocs/faq101.html#A5130 Another problem seems to be the apostrophes. Use two apostrophes inside the string to insert.