I have a question regarding the creation of a function which would return CLOB data type. This function will be used using a DB Link from a 10g database to a legacy 8i database.
The reason for using DBlink is because XMLAGG would not be possible to use in a legacy 8i database. I am combining multiple rows using XMLAGG to a single row which exceeds 32000 characters.
I tried creating a function using the below, however, resulted in error PLS-00103: Encountered the symbol "ORDER".
CREATE or replace FUNCTION get_clob_data (my_clob CLOB, prod_line NUMBER)
RETURN CLOB
AS
BEGIN
RETURN RTRIM (
XMLAGG (XMLELEMENT (
e,
REPLACE (
REGEXP_REPLACE (REPLACE (my_clob, CHR (10), '~~~'),
'[[:cntrl:]]'),
'~~~',
CHR (10)),
CHR (10)) ORDER BY prod_line).EXTRACT ('//text()').getclobval (),
CHR (10)) ;
END;
Not sure, whether a function is possible to create which would return CLOB with the above code and secondly I am able to access the function using a DB LInk if able to create a function.
Another question is does 8i have any solution to combine multiple rows as one row.
Appreciate any insight or help.