Oracle - 在 SELECT 上模拟触发器

发布于 2024-09-24 22:05:56 字数 305 浏览 3 评论 0原文

(当我找到答案时,我已经写出了这个问题,所以无论如何我都会发布它,因为谷歌没有给我任何有用的答案)。

我希望创建一个类似于在 Oracle SELECT 上触发的触发器的东西。目标是从 SELECT 结果中删除特定行,具体取决于执行 SELECT 的用户。

这需要在 Oracle 11g 标准版(而非企业版)上运行,因此我无法访问行级安全性或细粒度审计。

我有一个现有的(非常)遗留应用程序,它在各处都有数千个嵌入式选择,所以理想情况下我不想更改每一个...

我要使用的表有一百万个其中的行,从性能角度来看这在某种程度上限制了我。

(I had already written this question out when I figured out the answer, so I'll post it anyway since Google didn't give me any useful answers).

I'm looking to create something much like a trigger which fires on an Oracle SELECT. The goal is remove specific rows from the result of the SELECT depending which user is doing the SELECT.

This needs to work on the Standard Edition version of Oracle 11g (not Enterprise), so I don't have access to Row Level Security or Fine-Grained Auditing.

I've got an existing (very) legacy application which has thousands of embedded selects all over the place, so ideally I don't want to have to change every one...

The table I'm looking to work with has a million rows in it, which somewhat limits me from a performance perspective.

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

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

发布评论

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

评论(2

画尸师 2024-10-01 22:05:56

由于我只想修改 1 个特定表上的选择,因此我的答案是重命名现有表并使用原始名称创建一个视图。

Since I was only really looking to modify the select on 1 particular table, the answer for me was to rename the existing table and create a view with the original name.

离鸿 2024-10-01 22:05:56

我认为,PL SQL 块中的简单 if 条件可以解决您的问题。

I think, simple if condition in PL SQL block can resolve your problem.

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