cast TO_CHAR to fix issues with xmltable function