CREATE TABLE lhtest1(
C1 varchar(10 char),
C2 varchar(10 char),
C3 varchar(10 char),
C4 varchar(10 char),
C5 varchar(10 char),
C6 varchar(10 char),
C7 varchar(10 char),
C8 varchar(10 char),
C9 varchar(10 char),
C10 varchar(10 char),
C11 varchar(10 char),
n1 number(9));
WITH distribution
AS (SELECT
C1,
C2,
C3,
C4,
C5,
C6,
C7,
C8,
C9,
round(N1) ,
round(N1
/ SUM (
N1)
OVER (
PARTITION BY C1,C2,C3,C4),2)
OSUUS,
round (SUM (
N1)
OVER (
PARTITION BY C1,C2,C4,C5,C6,C7,C8,C9) -- change / on following line to *
/
SUM (
N1)
OVER (
PARTITION BY C1,C2,C4),2)
FROM ( SELECT C1,
C2,
C3,
C4,
C5,
C6,
C7,
C8,
C9,
SUM (N1) N1
FROM LHTEST1
GROUP BY C1,
C2,
C3,
C4,
C5,
C6,
C7,
C8,
C9
HAVING SUM (N1) > 0))
select* from DISTRIBUTION
order by
C1,
C5,
C7;
Please execute above code.
This is nothing to do with analytics. You'll get the same problem if you place forward slash on its own line in any statement:
SQL> select 2
2 /
select 2
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
SQL> 1
1* select 2
SQL> from dual;
SP2-0042: unknown command "from dual" - rest of line ignored.
You get this because / is the command to execute the command in the buffer:
http://docs.oracle.com/database/122/SQPUG/slash.htm#SQPUG162 To avoid this problem, format your code so there are other characters on the same line as the forward slash:
SQL> select 2 /
2 1
3 from dual;
2/1
----------
2
SQL>
SQL> select 2
2 / 1
3 from dual;
2/1
----------
2