我需要将 Oracle SQL 语句转换为存储过程,因此权限较低的用户可以访问某些数据字段:
SELECT
info_field, data_field
FROM
table_one
WHERE
some_id = '<id>' -- I need this <id> to be the procedure's parameter
UNION ALL
SELECT
info_field, data_field
FROM
table_two
WHERE
some_id = '<id>'
UNION ALL
SELECT
info_field, data_field
FROM
table_three
WHERE
some_id = '<id>'
UNION ALL
...
鉴于我不是 SP 专家,我一直无法找到一个好的解决方案来遍历所有相关的表(大约 12 个)。
任何想法都会有所帮助。非常感谢!