oracle内联视图可以跨java语句使用而不是创建临时表吗
我有一个java程序使用相同的内联视图执行3个单独的sql - 执行sql时每次构建内联视图大约需要20分钟 - 有没有办法缓存或重用它? - 尝试避免临时表解决方案,因为它需要委托给 plsql,因为 java 程序没有创建模式对象的权限。 PS:甲骨文10g
i have a java program executing 3 separate sqls with a same inline view - it takes about 20 minutes each time to build the inline view when the sqls are executed - is there a way to cache or reuse it ? - trying to avoid temporary table solution because it needs to be delegated to a plsql since the java program does not have rights to create schema objects.
ps: oracle 10g
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您允许,Oracle 将尽力缓存结果。但如果您确实愿意,您仍然可以拥有一个临时表,而且它相当小。如果您使用包,则可以在第一次调用时创建临时表,并在另外 2 次中使用缓存的数据 - 尝试包变量,看看是否符合您的要求。
Oracle will do its best to cache the result if you let it. But you can still have a temp table if you really want to, and it is fairly small. If you use a package you can create the temp table the first time it is called and use the cached data the other 2 times -- try out the package variables and see if that does what you want.
Oracle 临时表不应即时创建。文档此处。如果为此使用临时表,则创建一次并仅在过程中使用它。
另一种选择可能是物化视图。文档此处。物化视图可以按需或按计划刷新。
根据所提供的信息,无法告诉您哪一种更适合您的情况。
Oracle temp tables should not be created on the fly. Docs here. If you use a temporary table for this create it once and just use it in the procedure.
Another option may be a materialized view. Docs here. The materialized view would be either refreshed on demand or on a schedule.
With the information given it is not possible to tell you which would fit your situation better.