Question
· Feb 13

Query Updates with Escape logic to the apostrophe (i.e. double-up the single quote character) causing maxlength error.

When I use Escape logic when inserting or updating Oracle Table I'm getting Max-Length exceeded error. With the original value the length is good but after I add Escape Logic, it causes value to be greater than max-length. The original value was "I visited O'Brien before heading out of town." and after added Escape logic it was "I visited O''Brien before heading out of town." Max-Length is 45.

INSERT INTO MyText
    (text)
VALUES
    ('I visited O''Brien before heading out of town.')
                 /\
             right here  

Any ideas around this?

SQL %Execute QUERY ERROR - %SQLCODE=-400 - %Message=ORA-12899: value too large for column "SCHOOL"."ADDRESS"."NAME" (actual: 47, maximum: 40)

 - PrepStmtData="Monika''''''''''''''''''''''''''''''''s Test AC" - SQL ERROR CODE SCHOOL.ADDRESS 

Product version: IRIS 2023.1
Discussion (5)3
Log in or sign up to continue

The best and most correct solution would be to use parameters in SQL and pass a value as a parameter

INSERT INTO MyText
    (text)
VALUES
    (?)

While you have Oracle somewhere behind, Oracle should support parameters as well, but I don't know how it will work in this case

The increase may appear due to passing this query to the next database, and it escaped again. Passing as parameters may solve this issue.

But still even without this apostrophe the string is too long