在 Oracle Application Express (ApEx) 3.0 中添加列时 SELECT * 中断
当我将报表区域的 SQL 定义为 SELECT * FROM some_table 时,一切都很好,直到将新列添加到 some_table 为止 - 然后它会因“ORAxxx 未找到数据”错误而中断。 修复起来很容易,因为即使不进行任何更改,再次在该区域应用更改就足够了。 然而,它并不能构成一个强大的应用程序。
是否有一些参数组合允许 SELECT * 不会因新列而中断? 将任何默认格式或标题应用于新列就足够了。
我知道我可以从数据字典构造列列表,然后将所有内容连接到 SELECT 语句中进行评估,但这看起来相当不优雅。
When I define a report region's SQL as SELECT * FROM some_table, all is fine until new columns are added to some_table -- then it breaks with a "ORAxxx No data found" error. It is easy to remediate, as it's enough to Apply Changes on the region again, even without making any changes. However, it does not make for a robust application.
Is there some combination of parameters that would allow SELECT * that does not break with new columns? It would be enough to apply any default formatting or heading to the new columns.
I'm aware I could construct the column list from data dictionary and then concatenate everything into the SELECT statement to evaluate, but this seems rather inelegant.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常不建议使用
SELECT *
查询,因为:SELECT *
,我的意思是准确给出您需要的列,添加新列对应用程序来说并不重要。无论如何,请记住,为视图创建 SELECT * ,oracle 创建视图替换所有列的
*
,可能 APPEX 正在做同样的事情。Normally is not recommended to use
SELECT *
queries because:SELECT *
, I mean giving exactly the columns you need, adding new columns does not matter to the application.Anyway, remember that creating a
SELECT *
for a view, oracle create the view replacing the*
for all the columns, may be APPEX is making the same thing.目前,您的区域源(我认为)设置为“使用特定于查询的列名称并验证查询”。 这意味着为查询中的每一列显式定义了一个报告列,并且 SQL 应是静态的。
如果将区域源更改为“使用通用列名称(仅在运行时解析查询)”,则在添加新列后它仍然有效,列标题默认为列名称。
还有另一个属性“通用报告列的最大数量”,默认为 60,并且必须设置为足够大的值以容纳将来添加到表中的任何列。
Currently your region source is (I presume) set to "Use Query-Specific Column Names and Validate Query". This means that a report column is defined explicitly for each column in the query, and the SQL is expected to be static.
If you change the region source to "Use Generic Column Names (parse query at runtime only)", then it will still work after a new column is added, with the column title defaulting to the column name.
There is another property "Maximum number of generic report columns" that defaults to 60 and must be set to a value big enough to accommodate any future columns added to the table.