Friday 6 March 2020

String conversion into table/column output for comparison into in clause and many more

FUNCTION pipe_delimited_string ( p_source_list VARCHAR2, p_delimiter VARCHAR2 DEFAULT ',' )
RETURN varchar2
PIPELINED IS
xxit_varchar varchar2(4000);
--pass string delimited with comma and get list of columns.
BEGIN
FOR x IN (     SELECT TRIM ( REGEXP_SUBSTR ( p_source_list,
   '[^' || p_delimiter || ']+',
   1,
   LEVEL ) )
   col_value
   FROM DUAL
CONNECT BY REGEXP_SUBSTR ( p_source_list,
'[^' || p_delimiter || ']+',
1,
LEVEL )
   IS NOT NULL ) LOOP
 PIPE ROW( x.col_value);
END LOOP;
END pipe_delimited_string;

No comments:

Post a Comment