Hello community,
during development of a generic interface some weeks ago I noticed, that the ANYDATA-Type seems to not fully support INTEGER. I tested the following example code agains an Oracle DB 19c:
CREATE OR REPLACE TYPE type_object IS OBJECT
(
string VARCHAR2 (3 CHAR),
num NUMBER,
int INTEGER
);
DECLARE
v_object type_object
:= NEW type_object (string => 'abc', num => 1, int => 2);
v_anydata ANYDATA := anydata.convertobject (obj => v_object);
v_string VARCHAR2 (3 CHAR);
v_num NUMBER;
v_result PLS_INTEGER;
BEGIN
v_anydata.piecewise ();
v_result := v_anydata.getvarchar2 (c => v_string);
dbms_output.put_line (v_string);
v_result := v_anydata.getnumber (num => v_num);
dbms_output.put_line (v_num);
--Following Statement results in ORA-22626
v_result := v_anydata.getnumber (num => v_num);
dbms_output.put_line (v_num);
END;
/
Full INTEGER support would be great and I don't understand, why this is not implemented. There is no ANYDATA.getinteger - method yet. This would be usefull for the implementation af generic interfaces or helper routines, so you are able to give any object to a central routine and access the individual attributes programmatically.
What do you think about this? Do you have any ideas about this problem?
Thank you very much in advance,
best regards
Jan