Technologies:
Tolerim
a month ago
How can I fix the error message stating 'unimplemented or unreasonable conversion requested'?
stringify(rec, "ISTRANSACTION=${IsTransaction}^COMPANYID=${CompanyId}^PRTRANSACTIONSEQ=${PrTransactionSeq}^SPRICE=${SPrice}^SQUANTITY=${SQuantity}^", JSON) into SelectionVar;
FUNCTION Get_Records(
selectionstring IN VARCHAR2 ) RETURN VARCHAR2
IS
records jsonarray :=
jsonarray.parse(selectionstring_);
currentselection VARCHAR2(32000);
BEGIN
//Code
END;
Answers(2)
Vogi
a month ago
Verified Answer
The error message "unimplemented or unreasonable conversion requested" is usually caused by an unsupported format conversion. It is possible that the selection string data type is too large for the function to handle. You could try using a different data type such as BLOB instead of CLOB.
You could also try using the JSON.stringify() function with a replacer parameter instead of the current implementation. The replacer parameter can be used to transform values and properties encountered during the stringification process.
Here's an example of how you can use the replacer parameter:
function replacer(key, value) {
if (typeof value === 'string') {
return undefined;
}
return value;
}
JSON.stringify({ name: 'John', age: 30 }, replacer);
This will remove all string values from the resulting JSON string.
I hope this helps!Sources
ORA-01460: unimplemented or unreasonable conversion requested tipsJavascript JSON.stringify function is not workingJSON.stringify() - JavaScript | MDN - Mozilla DeveloperTolerim
a month ago
The 'unimplemented or unreasonable conversion requested' error is related to the size of the VARCHAR2 datatype used for the selection string. Since the maximum size of a VARCHAR2 is 32767, it cannot handle larger data sizes. Changing the datatype to CLOB solves this problem for some more number of records but does not work for a lot number of records as expected.
One solution to this problem is to split the input parameter into smaller parts (i.e., smaller than 32767) and call the function multiple times with different parts of the input parameter. Then, concatenate the results to get the final output. Another solution is to use a BLOB datatype instead of a CLOB, which allows storing larger data sizes. To use BLOB, you need to convert the input parameter to binary data using utl_raw.cast_to_raw function and decode it inside the function using utl_raw.cast_to_varchar2 function.
Here is an example of how to use BLOB in your code:
selection_string_ IN BLOB ) RETURN VARCHAR2
IS
records_ json_array :=
json_array(parse(utl_raw.cast_to_varchar2(selection_string_)));
current_selection_ VARCHAR2(32000);
BEGIN
-- Code
END;
In this example, we have changed the datatype of the input parameter to BLOB and used utl_raw.cast_to_raw function to convert the input parameter to binary data. In the function, we have used utl_raw.cast_to_varchar2 function to decode the binary data back to VARCHAR2. This should solve the problem with large data sizes.