I am getting “ORA-21560: argument 3 is null, invalid, or out of range” error on running query:
SELECT extractvalue(xmltype(blob2clob(shblobdata.blobdata)),
'/booked-order/ads/online-content[name="quantity"]/value')
FROM shblobdata
WHERE id=...;
the full error is:
ORA-21560: argument 3 is null, invalid, or out of range
ORA-06512: at "SYS.DBMS_LOB", line 978
ORA-06512: at "MORAS.BLOB2CLOB", line 14
21560 . 00000 – “argument %s is null, invalid, or out of range”
*Cause: The argument is expecting a non-null, valid value but the
argument value passed in is null, invalid, or out of range.
Examples include when the LOB/FILE positional or size
argument has a value outside the range 1 through (4GB – 1),
or when an invalid open mode is used to open a file, etc.*Action: Check your program and correct the caller of the routine
to not pass a null, invalid or out-of-range argument value.
I have tried to change “quantity” to ”quantity” (changing single quote to two apostrophes), but got the same error.
The content of blob is:
<?xml version="1.0" encoding="utf-8"?>
<booked-order>
<ads>
<online-content>
<name>quantity</name>
<value>19872</value>
</online-content>
</ads>
</booked-order>
The problem is in your custom function MORAS.BLOB2CLOB.
Also the error message says clearly
ORA-06512: at "MORAS.BLOB2CLOB", line 14The extract itself is ok, when you keep out BLOB2CLOB and test with
it returns
19872I’d first debug your function blob2clob with
And if that works ok continue on to the XML parts.