Select 来自 :LOV 报告/使用 LOV 作为 table_name 绑定变量
Select from :LOV report / Using LOV as table_name bind variable
我正在尝试创建一个页面,其中包含一个值列表 (P2_LIST
) 和一个区域,该区域根据 table 中的名称显示 table 的内容这个列表
例如
select * from :P2_LIST
但是我无法保存它:
ORA-06550: line 1, column 21: ORA-00903: invalid table name
P2_LIST
是一个包含仅包含有效 table 名称的列表的 LOV。
有办法吗?
当我从 dual 执行 select P2_LIST
时,我可以看到它包含正确的 TABLE_NAME
,如果我对 table 名称进行硬编码,那么它 returns还有。
我的想法是,只需向共享组件添加一个条目,我就可以向此页面添加更多 table。
如果这可以解决,我的下一部分是我也想为此使用连接值:
例如如果我有两个 tables:
- thisistable_1 - 提交这是table
- thisisnottable_1 - 提交 thisisnottable
然后我想使用以下内容:
select * from :P2_LIST||_1
这样我就可以在其他地方使用相同的 LOV。
我是运行:Application Express 5.0.3.00.03
我只能在这里建议如下。为每个 table 创建一个区域,然后在 Conditions
选项卡上的区域属性中 select
Condition Type
- Value of Item / Column in Expression 1 = Expression 2
Expression 1
- P2_LIST
(没有冒号)
Expression 2
- 这个地区 table 的名字
提交后您的页面将显示 selected table 的查询结果。
是,使用动态 SQL 查询。
而不是 select * from :P2_LIST
像这样定义报告:
declare
q long;
begin
q := 'select * from ' || :P2_LIST || ';';
return q;
end;
您还需要:
- 检查区域源下的"Use Generic Column Names (parse query at runtime only)"设置
- 确保源类型是"SQL query (PL/SQL function body returning SQL query)"
- 将标题类型设置为 "Column Names (InitCap)"
(注意 PL/SQL 中的 long
是定义为 varchar2(32760)
的子类型,我只是用它来节省输入!)
我正在尝试创建一个页面,其中包含一个值列表 (P2_LIST
) 和一个区域,该区域根据 table 中的名称显示 table 的内容这个列表
例如
select * from :P2_LIST
但是我无法保存它:
ORA-06550: line 1, column 21: ORA-00903: invalid table name
P2_LIST
是一个包含仅包含有效 table 名称的列表的 LOV。
有办法吗?
当我从 dual 执行 select P2_LIST
时,我可以看到它包含正确的 TABLE_NAME
,如果我对 table 名称进行硬编码,那么它 returns还有。
我的想法是,只需向共享组件添加一个条目,我就可以向此页面添加更多 table。
如果这可以解决,我的下一部分是我也想为此使用连接值:
例如如果我有两个 tables:
- thisistable_1 - 提交这是table
- thisisnottable_1 - 提交 thisisnottable
然后我想使用以下内容:
select * from :P2_LIST||_1
这样我就可以在其他地方使用相同的 LOV。
我是运行:Application Express 5.0.3.00.03
我只能在这里建议如下。为每个 table 创建一个区域,然后在 Conditions
选项卡上的区域属性中 select
Condition Type
-Value of Item / Column in Expression 1 = Expression 2
Expression 1
-P2_LIST
(没有冒号)Expression 2
- 这个地区 table 的名字
提交后您的页面将显示 selected table 的查询结果。
是,使用动态 SQL 查询。
而不是 select * from :P2_LIST
像这样定义报告:
declare
q long;
begin
q := 'select * from ' || :P2_LIST || ';';
return q;
end;
您还需要:
- 检查区域源下的"Use Generic Column Names (parse query at runtime only)"设置
- 确保源类型是"SQL query (PL/SQL function body returning SQL query)"
- 将标题类型设置为 "Column Names (InitCap)"
(注意 PL/SQL 中的 long
是定义为 varchar2(32760)
的子类型,我只是用它来节省输入!)