我在连接列上使用order by子句时遇到错误。
“不一致的数据类型:预期 - 得到了CLOB”
功能:
create or replace FUNCTION LIST_PNUM (CID in NUMBER) RETURN CLOB
IS
l_text clob := NULL;
BEGIN
FOR cur_rec IN (SELECT C.E_DEVICE FROM CUSTOMER_PCN A, CP_DEVICE B, ET_DEVICE C WHERE A.C_ID = CID AND A.CP_ID = B.CP_ID AND B.ET_DEVICE_ID=C.ET_DEVICE_ID AND ROWNUM <= 250 ORDER BY C.E_DEVICE )
LOOP
l_text := l_text || ',' || cur_rec.e_device;
END LOOP;
RETURN LTRIM(l_text, ',');
END LIST_PNUM;
查看:
CREATE OR REPLACE VIEW "MYView" ("P_ID", "E_DEVICE") AS
select p.p_id, LIST_PNUM(c.customer_id) AS e_device
from Table ..... where Condition;
选择声明:
select p_id, e_device from MYView order by e_device desc;
错误:
“不一致的数据类型:预期 - 得到了CLOB”