Forms6i - PRE-INSERT and PRE-UPDATE issue [message #429880] |
Fri, 06 November 2009 01:33 |
ap_karthi
Messages: 87 Registered: October 2007 Location: Bangalore
|
Member |
|
|
Hello,
Download the form and script inside the form (script trigger in form level)
First run the script in the database, then only you can debug the program.
Steps to follow.
Method I:
1. Run the form. Press F8. Now the cursor is in first record.
2. Press F6 and F4 (inserts and duplicates). In the 2nd record change the Owner seq "86" to "86.01" and change the owner ref " * " to "5.6", then clear the remaining four columns.
3. Follow step 2 and change 86.01 to 86.02 and 5.6 to 5.7, then clear the remaining column.
4. Save it. It works fine.
Method II:
1. Run the form. Press F8. Now the cursor is in first record.
2. Press F6 and F4 (inserts and duplicates). . In the 2nd record change the Owner seq "86" to "86.01" and change the owner ref " * " to "5.6", then clear the remaining four columns.
3. Go to 3rd record and change the owner ref " * " to 5.7.
4. Save it. It shows error as Serial_n column is null.
5. Exit without saving and comment the Pre-update trigger and save the program.
6. Follow the step 1, step 2, step3.
7. Save it. It saves the records.
So the problem is in pre-insert or pre-update. What's the problem?
Hope you can understand. Thanks.
-Karthik
-
Attachment: est_itm.fmb
(Size: 60.00KB, Downloaded 1339 times)
|
|
|
|
|
|
Re: Forms6i - PRE-INSERT and PRE-UPDATE issue [message #430151 is a reply to message #430120] |
Mon, 09 November 2009 04:03 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
ORA-01400 is result of an attempt to insert NULL value into a column which is declared as NOT NULL.
Is "serial_n" NOT NULL? Yes, it is. Can you insert NULL into it? No, you can not.
PRE-INSERT trigger contains SELECT statement that selects "max + 1" into the "serial_n" item, but there are two facts one could mention:- "max + 1" principle works fine (if correctly set - which you didn't) in a single-user environment. Otherwise, it might cause DUP-VAL-ON-INDEX error (if two or more users try to insert the same "max + 1" value into a column which is designed as unique). For unique values, use Oracle object called sequence
- Your "max + 1" doesn't work correctly. Here's why, based on a simple example in Scott's schema (there's no department in the "dept" table whose location is "Zagreb"):
SQL> select * from dept where loc = 'Zagreb';
no rows selected
Your query: the result is NULL (this is what you are trying to insert into the "serial_n" column):SQL> select max(nvl(deptno, 0)) + 1 from dept where loc = 'Zagreb';
MAX(NVL(DEPTNO,0))+1
--------------------
SQL>
Another way:SQL> select nvl(max(deptno), 0) + 1 from dept where loc = 'Zagreb';
NVL(MAX(DEPTNO),0)+1
--------------------
1
SQL>
|
|
|
|
|
|
Re: Forms6i - PRE-INSERT and PRE-UPDATE issue [message #430381 is a reply to message #429880] |
Tue, 10 November 2009 04:44 |
cookiemonster
Messages: 13961 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I have read it from the begining. Not sure why you think I haven't.
Is the code in the pre-update trigger still this:
:upd_d := SYSDATE;
:upd_userid_n := USER;
Becuase if it is then my suggestion before is the only possibility that makes any sense to get that error. The first line can't give it so the second must be.
|
|
|
|
|
|
|
|
|
Re: Forms6i - PRE-INSERT and PRE-UPDATE issue [message #430884 is a reply to message #430572] |
Thu, 12 November 2009 20:02 |
ap_karthi
Messages: 87 Registered: October 2007 Location: Bangalore
|
Member |
|
|
I installed form6i and patch18.
Can you both e-mail the version details, with which version you are testing it?
My version details as follows...
Forms [32 Bit] Version 6.0.8.27.0 (Production)
Oracle Toolkit Version 6.0.8.25.0 (Production)
PL/SQL Version 8.0.6.3.0 (Production)
Oracle Procedure Builder V6.0.8.21.0 Build #1459 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle Query Builder 6.0.7.1.0 - Production
Oracle Virtual Graphics System Version 6.0.5.38.0 (Production)
Oracle Tools GUI Utilities Version 6.0.8.25.0 (Production)
Oracle Multimedia Version 6.0.8.25.0 (Production)
Oracle Tools Integration Version 6.0.8.18.0 (Production)
Oracle Tools Common Area Version 6.0.8.18.0
Oracle CORE Version 4.0.6.0.0 - Production
|
|
|
|
Re: Forms6i - PRE-INSERT and PRE-UPDATE issue [message #431050 is a reply to message #430900] |
Fri, 13 November 2009 17:40 |
ap_karthi
Messages: 87 Registered: October 2007 Location: Bangalore
|
Member |
|
|
Hello Mr.Littlefoot / Mr.Robert,
Version matters, because oracle fixes some bugs and releases patches. Hope you know that one.
I tried in a new machine.
Installed Forms6i only (no patch)
The version is shown below,
Forms [32 Bit] Version 6.0.8.11.3 (Production)
Oracle Toolkit Version 6.0.5.35.0 (Production)
PL/SQL Version 8.0.6.0.0 (Production)
Oracle Procedure Builder V6.0.8.11.0 Build #449 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle Query Builder 6.0.7.0.0 - Production
Oracle Virtual Graphics System Version 6.0.5.35.0 (Production)
Oracle Tools GUI Utilities Version 6.0.5.35.0 (Production)
Oracle Multimedia Version 6.0.5.34.0 (Production)
Oracle Tools Integration Version 6.0.8.10.2 (Production)
Oracle Tools Common Area Version 6.0.5.32.1
Oracle CORE Version 4.0.6.0.0 - Production
There was no issue, I was able to insert as shown by you before.
Then, I installed the patch 18, the version changes as shown below,
Forms [32 Bit] Version 6.0.8.27.0 (Production)
Oracle Toolkit Version 6.0.8.25.0 (Production)
PL/SQL Version 8.0.6.3.0 (Production)
Oracle Procedure Builder V6.0.8.21.0 Build #1459 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle Query Builder 6.0.7.1.0 - Production
Oracle Virtual Graphics System Version 6.0.5.38.0 (Production)
Oracle Tools GUI Utilities Version 6.0.8.25.0 (Production)
Oracle Multimedia Version 6.0.8.25.0 (Production)
Oracle Tools Integration Version 6.0.8.18.0 (Production)
Oracle Tools Common Area Version 6.0.8.18.0
Oracle CORE Version 4.0.6.0.0 - Production
Then the issue started, I was unable to save the record.
So I'm 100% sure, it is due to version issue only.
Note: Oracle user contains only 6 character.
Kindly try after updating the patch 18. Thank you.
-Karthik
|
|
|
|
|