oracle - oracle apex 更新语句(使用选择列表和 text_field 的返回值)
问题描述
update student set :P9_COLUMNNAME = :P9_VALUE
这是我的尝试,但它返回
ORA06550 错误 user.table 列、table.column 或列规范无效。
通常,当我从用户输入设置值时,它运行良好,但这次 oracle 不允许我以这种方式传递列值。有没有人遇到过同样的问题?提前致谢
psP9_columnname
是一个选择列表,p9_value
是一个文本字段
解决方案
UPDATE
应该用于更新表格列,而不是 Apex 应用程序中的项目。
所以,要么
update student set
some_column = :P9_VALUE
where ... --> don't forget the WHERE clause, otherwise you'll update the whole table
或者
:P9_COLUMNNAME := :P9_VALUE;
如果选择列表项包含列名,则必须使用动态 SQL。例如:
declare
l_str varchar2(200);
begin
l_str := 'update student set ' || :P9_COLUMNNAME || ' = ' || :P9_VALUE;
execute immediate l_str;
end;
不要忘记where
条款!
推荐阅读
- python - Pyspark 多标签文本分类
- javascript - 当用户无法登录 Okta 时重定向回应用程序并显示自定义错误页面
- javascript - 屏幕阅读器 Chromevox 聚焦时不阅读元素
- json - C'ant post 使用 Angular http 将帖子发送到 api 路由
- java - 我需要构建一个休息客户端,以在 java 中以最佳性能进行 10k 次休息 api 调用/执行应用程序。任何有用的链接都会有所帮助
- java - 我可以使用 java 'keytool' 为 Windows10 生成 Outlook 证书吗
- ruby-on-rails - rspec - 在测试中总是以状态 200 响应
- sql-server - 以前记录的累积更新
- php - 如何从此代码中获取出发和回程航班的分页结果
- java - 如何在 Kafka Admin API 中添加每个主题的配置?