NAME
DBIO::Oracle::Storage::LOBSupport - LOB binding and chunking for Oracle
VERSION
version 0.900007
DESCRIPTION
Handles Oracle LOB binding and chunked comparison logic.
METHODS
update
Returns the number of rows the UPDATE changed, 0E0 when none. When the statement was sent as a block (see "INSERT and UPDATE with LOB values") the count is the one the block read from SQL%ROWCOUNT, so $rs->update and the "no row matched" check of $row->update see the real number.
INSERT and UPDATE with LOB values
DBD::Oracle (1.95 and earlier, checked against Oracle 23ai) re-reads a LOB it has just written, from the table and column names it takes out of the INSERT/UPDATE text and upper-cases. A table or a LOB column that was created with a quoted lower-case or mixed-case name (what every quoting DBIO schema does) is not found: the statement dies with ORA-01741 or ORA-00904 although the SQL itself is valid, and without ora_type the same statement dies with ORA-01465 or ORA-24816. The refetch only looks at statements that begin with INSERT or UPDATE, so this storage sends every such statement that binds a LOB inside an anonymous block, BEGIN ... ; END;. The block runs the same statement, RETURNING ... INTO included, and DBD::Oracle binds the LOB with ora_type as before, but without the refetch. The upstream report draft is maint/upstream/dbd-oracle-lob-refetch-quoted-identifiers.md.
Comparing a LOB by value
A LOB cannot be compared with = (ORA-22848), so a condition { col => $value } on a LOB column is written as one comparison per part of the value, joined with AND, each on DBMS_LOB.SUBSTR of the column.
Text. Parts of 1000 characters, compared as
DBMS_LOB.SUBSTR(col, 1000, offset) = ?. 1000 and not the 2000 this module used to cut at: a SQL string holds 4000 bytes and a character is up to 4 of them in the database's UTF-8, so 2000 Japanese characters (6000 bytes) died with ORA-06502 at the fetch, on every row whose column was longer. The amount is the same for every part, also the last, so that a column that goes on beyond the value is not equal to it.Binary. Parts of 2000 bytes (what a
RAWholds), compared asDBMS_LOB.SUBSTR(col, 2000, offset) = HEXTORAW(?)with the part sent as hex: the comparison used for text turns arbitrary bytes into other ones, so a binary value was never found.Empty. An empty value is an empty LOB (not NULL: a LOB bound as
''is stored empty), compared asDBMS_LOB.GETLENGTH(col) = 0; a column that is NULL does not match.
AUTHOR
DBIO & DBIx::Class Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.