WM_CONCAT with DISTINCT Clause - Compiled Package versus Stand-Alone Query Issue
Posted
by
Reimius
on Stack Overflow
See other posts from Stack Overflow
or by Reimius
Published on 2013-10-24T21:43:07Z
Indexed on
2013/10/24
21:54 UTC
Read the original article
Hit count: 635
I was writing some program that uses the WM_CONCAT function. When I run this query:
SELECT WM_CONCAT(DISTINCT employee_id)
FROM employee
WHERE ROWNUM < 20;
It works fine. When I try to compile the relatively same query in a package function or procedure, it produces this error: PL/SQL: ORA-30482: DISTINCT option not allowed for this function
FUNCTION fetch_raw_data_by_range
RETURN VARCHAR2 IS
v_some_string VARCHAR2(32000);
BEGIN
SELECT WM_CONCAT(DISTINCT employee_id)
INTO v_some_string
FROM employee
WHERE ROWNUM < 20;
RETURN v_some_string;
END;
I realize WM_CONCAT is not officially supported, but can someone explain why it would work as a stand alone query with DISTINCT, but not compile in a package?
© Stack Overflow or respective owner