如何使用 Form Builder 和 PL/SQL 插入记录?
我正在慢慢学习 SQL 以及如何使用表单生成器 6。情况是我有一个名为“玩家”的简单表,表中我有三列:
- player_no(主键)
- 位置
- 目标
在表单生成器 6 中我创建了一个非常使用这三个字段的简单形式。 该表格名为“团队”。 在表单的底部有一个标有“添加”的按钮。 目标是让用户输入玩家编号、位置和目标,然后单击“添加”。 然后这些信息将进入我的表格。
迄今为止所有的尝试都惨遭失败。 我已经在按钮上设置了触发器(WHEN_MOUSE_CLICK)。 然后我输入了以下代码:
BEGIN
INSERT INTO players ( player_no )
VALUES ( :TEAM.player_no )
END
为了测试它,我只使用了 one (player_no) 字段。 然后编译没有错误,当我运行表单并输入player_no并点击按钮时,我在状态栏中收到以下错误:
frm-40735:WHEN-MOUSE-CLICK触发器引发了未处理的异常ORA-01400
我在做什么吗大错特错了? 我对 SQL 和 Form Builder 非常陌生,因此我们将不胜感激。
I'm slowly learning SQL and how to use form builder 6. The situation is I have a simple table named 'players' within the table I have three columns:
- player_no (primary key)
- position
- goals
Within form builder 6 I have created a very simple form using these three fields. The form is named 'TEAM'. At at the foot of the form I have a button labelled 'Add'. The goal is for the user to enter a player_no, position and goals and then to click 'Add'. This information is then to go into my table.
All attempts so far have failed miserably. I have set up a trigger on the button (WHEN_MOUSE_CLICK). I have then entered the following code:
BEGIN
INSERT INTO players ( player_no )
VALUES ( :TEAM.player_no )
END
For the purpose of testing it out I have only been using the one (player_no) field. This then compiles with no errors yet when I run the form and enter a player_no and hit the button I get the following error in the status bar:
frm-40735: WHEN-MOUSE-CLICK trigger raised unhandled exception ORA-01400
Am I doing something horribly wrong? I am very much new to SQL and Form Builder so any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ORA-01400:无法插入 Null 似乎您的字段之一不为空并且您在插入时省略了它们。 或值 :TEAM.player_no 在插入期间为 null。
另外,来自网络的某个地方:
ORA-01400: cannot insert Null seems like one of your fields are not null and you omited them on insert. or value :TEAM.player_no is null during insert.
Also, somewhere from web:
使用 Form Builder 的好处之一是您几乎总是不需要自己编写 DML 语句。
只需根据表创建块 - 然后用户可以添加和修改任意数量的记录,然后当他们保存(即提交)时,Forms 运行时会自动计算出保存更改所需的 INSERT 和 UPDATE。
One of the benefits of using Form Builder is that you almost always don't need to write the DML statements yourself.
Just make the block based on the table - then the user can add and modify as many records as they like, then when they save (i.e. COMMIT), the Forms runtime automatically works out what INSERTs and UPDATEs are required to save the changes.