Oracle - 创建物化视图

发布于 2024-12-21 16:30:50 字数 360 浏览 1 评论 0原文

我正在阅读一些文章,甚至堆栈上的一些答案,但我仍然有一些问题。我将发布我的 MV 代码以进行可能的分析:

CREATE MATERIALIZED VIEW some_materialized_view
REFRESH COMPLETE
START WITH sysdate
NEXT '2011-12-01' + 31
WIDTH PRIMARY KEY
AS my_query

错误是:

00984. 00000 -  "column not allowed here"

我忘记了什么吗?我唯一想要的就是我的MV每个月开始更新。有人可以帮忙吗?

谢谢!

I'm reading some articles, even some answers here on stack, but i still have some issues. I'll post my MV code for possible analysis:

CREATE MATERIALIZED VIEW some_materialized_view
REFRESH COMPLETE
START WITH sysdate
NEXT '2011-12-01' + 31
WIDTH PRIMARY KEY
AS my_query

The error is:

00984. 00000 -  "column not allowed here"

Am i forgeting something? The only thing i want is that my MV update every month beggining. Can someone help?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情愿 2024-12-28 16:30:50

您的命令中有两个语法错误。

子句 WIDTH PRIMARY KEY 应该是 WITH PRIMARY KEYWITH 上有拼写错误)

NEXT 子句是使用需要 date 关键字的日期文字:

NEXT DATE '2011-12-01' + 31

所以完整的命令应该是:

CREATE MATERIALIZED VIEW some_materialized_view
REFRESH
  COMPLETE
  START WITH SYSDATE
  NEXT DATE '2011-12-01' + 31
  WITH PRIMARY KEY
AS <your query here>

There are two syntax errors in your command.

The clause WIDTH PRIMARY KEY should be WITH PRIMARY KEY (you have a typo on WITH)

The NEXT clause is using a date literal which requires the date keyword:

NEXT DATE '2011-12-01' + 31.

So the full command should be:

CREATE MATERIALIZED VIEW some_materialized_view
REFRESH
  COMPLETE
  START WITH SYSDATE
  NEXT DATE '2011-12-01' + 31
  WITH PRIMARY KEY
AS <your query here>
笑梦风尘 2024-12-28 16:30:50

您可能应该首先查阅 Oracle 文档,尤其是语法问题。你想要的一切+更多都在那里。一旦您习惯了语言参考文档,它们就会非常有帮助,您可能会学到一些与您正在研究的内容相关的新知识。

You should probably consult the Oracle documentation first, esp for syntax questions. Everything you're asking + more is there. The language reference docs are very helpful once you're used to them, and you just might learn a few new things regarding what you're researching.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文