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.

没看懂,求大神帮忙解答!
...全文
201 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
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!

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧