|
-
Reply
Thanks,
The problem is that when I want to interpret dynamically the statement 'select count(ename),deptno from emp where deptno=10 group by deptno '
I write the following function
CREATE OR REPLACE FUNCTION FNC_2WCOLUMN_1AGGRCOLUMN(TABLE_NAME_VAR IN VARCHAR2,COLUMN_NAME_VAR IN VARCHAR2,
AGGREGATION_TYPE_VAR IN VARCHAR2,AGGR_COLUMN_VAR IN VARCHAR2)
RETURN NUMBER
AS
CURRENT_EXET_NUMBER NUMBER;
SQL_STMT VARCHAR2(500);
BEGIN
CURRENT_EXET_NUMBER:=0;
BEGIN
SQL_STMT:='SELECT '||AGGREGATION_TYPE_VAR||'('||COLUMN_NAME_VAR||'),'||AGGR_COLUMN_VAR||' FROM '||TABLE_NAME_VAR||
' WHERE '||COLUMN_NAME_VAR||'=10 GROUP BY '||':PAR1';
EXECUTE IMMEDIATE SQL_STMT INTO CURRENT_EXET_NUMBER USING AGGR_COLUMN_VAR;
END;
RETURN CURRENT_EXET_NUMBER;
END;
/
When I execute this using
SQL>SELECT FNC_2WCOLUMN_1AGGRCOLUMN('EMP','ENAME','COUNT','DEPTNO') FROM DUAL;
The error is :'ORA-00979 : not a goup by expression'
What may be the problem...? I also try out some other versions of this but the error is ORA-00932...
Thanks , again...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|