i am asking out of curiosity ,
can i create a view something like this? i tried to create,but got an error
SQL> create view emp_view as select sum(sal),sum(empno) from emp;
create view emp_view as select sum(sal),sum(empno) from emp
ERROR at line 1:
ORA-00998: must name this expression with a column alias
SQL> select sum(sal),sum(empno) from emp;
can i create a view based on the above select ?
if there is any other way, can somebody give an example ?
use a column alais thats what oracle is asking you to do something like this
CREATE VIEW emp_view as SELECT SUM(sal)sumsal,
SUM(empno)sumempno from emp;
although i am not sure what sum(empno) means in your case
hope this helps
sorry i forgot to include this line
you can then do
select sumsal,sumempno from emp;
What solution provided by hrishy is ok.
When ever you use any expression, functiion in select statement when creating view or cursor you have to give
thanks Hrishy and Psoni,it works!
Click Here to Expand Forum to Full Width