APEX ORACLE 如何使用一个表单将数据插入到多个表中 [英] APEX ORACLE How to use one form to insert data into multiple tables

查看:136
本文介绍了APEX ORACLE 如何使用一个表单将数据插入到多个表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道您是否可以帮助我解决我当前的问题,即使用单个表单将数据插入到关系数据库中的多个表中.我对 APEX 相当陌生,但对 mysql 和 php 编程有一些背景知识.过去,我通常通过创建我想要填充的不同表中所有列的视图并使用简单的插入命令来完成这样的任务,但在 apex 中做同样的事情会给我和错误说明ORA-01779:修改映射到非键保留表的列".

I was wondering if you can help me out with my current problem which is to insert data into multiple tables in my relational database using a single form. I am fairly new to APEX but do have a little bit of background on mysql and php programming. In the past, I normally achieve such task by creating a view of all the columns from different table that I want to populate and using a simple insert commands but doing the same thing in apex gives me and error stating that "ORA-01779: cannot modify a column which maps to a non key-preserved table".

推荐答案

在 Oracle 中,您不能只更新具有例如 JOIN 子句的视图.Oracle 不会将所有列映射回源表:一个表可能,而其他的则不会.这不是一个顶点问题:如果您要在 db 中针对您的视图运行更新,您也会收到此错误.

In Oracle you can not just update a view which has eg a JOIN clause. Oracle will not map all columns back to the source tables: one table might while the others won't. This isn't an apex problem: if you were to run an update against your view in the db you would get this error just as well.

如果你想让你的顶点屏幕尽可能保持透明,那么你可能需要考虑用户视图上的而不是触发器.不过,您必须在此触发器中编写正确的 dml 语句,以确保您的数据正确推送到所有表.
另一种选择是仅使用视图来获取,并使用不同的进程将数据推送到正确的表.使用数据层包可能会减少使用存储在 apex 中的代码(例如,在 apex 中拥有大量 plsql 代码通常是不受欢迎的,而是存储在包中).

If you want to have your apex screen remain as transparent as possible, then you may want to consider user an instead-of trigger on the view. You will have to write the correct dml statements in this trigger though in order to ensure your data is pushed through correctly to all tables.
Another option is to use the view only to fetch, and use different processes to push the data to the correct tables. Using data-layer packages might alleviate the use of code stored in apex (eg having a lot of plsql code in apex itself is usually not favored and is rather stored in packages).

这篇关于APEX ORACLE 如何使用一个表单将数据插入到多个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆