我正在尝试在连接到oracle DB的iSQL中执行LISTAGG。
以下查询运行正常并返回106个结果。
SELECT DISTINCT owner FROM dba_segments WHERE owner NOT IN ('SYS', 'SYSTEM', 'EXFSYS', 'DBSNMP', 'SQLTXPLAIN', 'XDB', 'WMSYS', 'PERFSTAT', 'OUTLN');
尝试LISTAGG我收到以下错误:
方法1:
SELECT LISTAGG(DISTINCT owner, ', ') WITHIN GROUP (ORDER BY owner) FROM dba_segments WHERE owner NOT IN ('SYS', 'SYSTEM', 'EXFSYS', 'DBSNMP', 'SQLTXPLAIN', 'XDB', 'WMSYS', 'PERFSTAT', 'OUTLN');
返回:
[ISQL]ERROR: Could not SQLExecute
方法2:
SELECT LISTAGG(owner, ', ') WITHIN GROUP (ORDER BY owner) FROM (SELECT DISTINCT owner FROM dba_segments WHERE owner NOT IN ('SYS', 'SYSTEM', 'EXFSYS', 'DBSNMP', 'SQLTXPLAIN', 'XDB', 'WMSYS', 'PERFSTAT', 'OUTLN'));
返回:
LISTAGG(OWNER,',')WITHINGROUP(ORDERBYOWNER)
像LISTAGG
这样的函数甚至可以使用ODBC连接到Oracle,从iSQL开始工作。
编辑 - 我发现以下内容看起来不允许? Allowed Functions
Oracle Database Gateway for ODBC assumes that ODBC driver provider that is being used supports the following minimum set of SQL functions:
AVG(exp)
LIKE(exp)
COUNT(*)
MAX(exp)
MIN(exp)
NOT
答案 0 :(得分:0)
根据我在quesiton中的注释,isql无法访问Oracle中的系统函数。