【发布时间】:2021-03-11 13:55:59
【问题描述】:
我不知道什么是我的问题的最佳解决方案。我需要一个参数的函数,结果是
VAL
-----
1
2
3
在函数中我需要把 union all 来获取所有值。
Select column_1 as VAL from my_table where id = P_FUNCTION_PARAMETER --return 1
union all
Select column_2 as VAL from my_table where id = P_FUNCTION_PARAMETER --return 2
union all
Select column_3 as VAL from my_table where id = P_FUNCTION_PARAMETER; --return 3
什么是最好的解决方案?
【问题讨论】:
-
所以
column_1、column_2、column_3都是number数据类型?而且,为什么你需要用一个函数来做到这一点?在普通 SQL 中获取这样的表是一项微不足道的任务。 -
@mathguy 在我的应用程序查询编辑器中调用 sql 查询时出现错误:值太长了 XXX 个字符!
标签: sql oracle stored-functions