SYS.ANYDATE (Generic Data Type) is an object type that used to store different data types in Table, or create variable that can setted by any data-type.
For example I will create new table below
CREATE TABLE ANYDATA_TABLE
(
ID NUMBER NOT NULL,
ADT_COLUMN SYS.ANYDATA
);
Now I will try to insert different data types in col2
insert into anydata_table values(1,sys.anydata.convertnumber(1)) / insert into anydata_table values(2,sys.anydata.convertdate(sysdate)) / insert into anydata_table values(3,sys.anydata.convertvarchar2('Mahmoud Ahmed El-Sayed')) /
Note that I use anydata.convertnumber, anydata.convertdate and anydata.convertvarchar2 to specify data type of inserted data
let's now query data from table
SELECT * FROM ANYDATA_TABLE;
The data of ADT_COULMN is unreadable in result set as below pictureSo I need to retrieve readable value of ADT_COLUMN from query
We can do this by below steps
1-Determine data type of inserted data in ADT_COLUMN
2-Create different functions to return equivalent data type for every inserted data in ADT_COLUMN
I will create these functions in package called ANYDATA_PKG
3-Use ANYDATA built-in member functions to do equivalent of ANYDATA_PKG in #2