ORA-32614: illegal MODEL SELECT expression

qq_40608182 2017-11-27 11:03:41
执行以下SQL语句时,出现ORA-32614: illegal MODEL SELECT expression 错误提示。
请教下大神,什么原因造成的,如果解决?不甚感激!

select to_date(stat_date,'yyyy-mm-dd') as "时间",cust_num,new_cust_num,'口袋APP下载' as "指标类型",cn "指标项",cv "指标值"
from (select stat_date,
sum(cust_num) as cust_num,
sum(cust_num)- nvl(lag(sum(cust_num))over(order by stat_date),0) new_cust_num,
round(sum(app_num)*100/sum(cust_num),2) as app_rate,
sum(app_num) as app_num,
sum(app_num) - nvl(lag(sum(app_num))over(order by stat_date),0) new_cust_num2
from tmp
group by stat_date
)
where stat_date is not null
model
return updated rows
partition by (stat_date)
dimension by (0 as n)
measures(cast('x' as varchar2(40)) as cn, cast(1 as number(30)) as cv, app_rate as c1,app_num as c2,new_cust_num2 as c3)
rules upsert all
(
cn[1] = 'App下载率(%)',
cn[2] = '累计下载客户数',
cn[3] = '当周新增客户数',
cv[1] = c1[0],
cv[2] = c2[0],
cv[3] = c3[0]
)


网上百度了下:
Description:illegal MODEL SELECT expression
Cause: An expression other than MODEL aliases, constants, or expressions of the two is specified in the MODEL SELECT clause.
Action: Reformulate the query, perhaps nesting inside another SELECT.

没看懂,求大神帮忙解答!
...全文
137 3 点赞 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
碧水幽幽泉 2017-11-28
partition by (stat_date) 改成: partition by (stat_date,cust_num,new_cust_num) 试试看~
  • 打赏
  • 举报
回复
qq_40608182 2017-11-28
可以帮忙再解释下以下英文吗? 谢谢! Description:illegal MODEL SELECT expression Cause: An expression other than MODEL aliases, constants, or expressions of the two is specified in the MODEL SELECT clause. Action: Reformulate the query, perhaps nesting inside another SELECT.
  • 打赏
  • 举报
回复
qq_40608182 2017-11-28
引用 1 楼 qq646748739 的回复:
partition by (stat_date) 改成: partition by (stat_date,cust_num,new_cust_num) 试试看~
改了之后运行OK!
  • 打赏
  • 举报
回复
相关推荐
发帖
Oracle
加入

1.6w+

社区成员

Oracle开发相关技术讨论
申请成为版主
帖子事件
创建了帖子
2017-11-27 11:03
社区公告
暂无公告