Home » Developer & Programmer » Forms » code
code [message #385244] Sun, 08 February 2009 04:00 Go to next message
Messages: 48
Registered: January 2009
I need someone to check the code below and tell me why isn't the Insert statment working:

a number;
n number;
cursor c is select unit_no,dept_no,div_no from wo_det where wo_no=:global.wo_no and copy_no=a;
c_unit wo_det.unit_no%type;
c_dept wo_det.dept_no%type;
c_div wo_det.div_no%type;
update wo_trans set cne_app=3 where wo_no=:global.wo_no and copy_no=a;
commit; /* Q.1 --> shows FRM 40401 no changes where there is an actual update */
select max(copy_no) into n from wo_trans where wo_no=:global.wo_no;
insert into wo_trans values (:global.wo_no,:global.copy_no,:wo_trans.emp_no,
:control2.modify_txt,null); /* Q.2 --> doesn't insert */

open c;
fetch c into c_unit,c_dept,c_div;
exit when c%notfound;
insert into wo_det(wo_no,copy_no,unit_no,dept_no,div_no,status_no,unit_app,
dept_app) values (:global.wo_no,:global.copy_no,c_unit,c_dept,c_div,0,0,0); /* doesn't insert because wo_trans record above has not been inserted */
end loop;
close c;

[Updated on: Sun, 08 February 2009 05:45]

Report message to a moderator

Re: code [message #385251 is a reply to message #385244] Sun, 08 February 2009 08:46 Go to previous message
Messages: 20849
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
A1: Message you received notifies you that there was nothing to save as nothing has changed in a form. Use STANDARD.COMMIT instead - it will bypass all checking and do what you've said: commit, right away!

A2: "doesn't insert" is not really an Oracle error message. Was there any error? If so, which one? Insert *should* succeed unless there was something that prevented it doing so (for example, NULL value for a NOT NULL column, violated unique constraint etc.). In any other case, hm, I think it just should work.

A3: As you've said, this might work when you make the Q3/A3 INSERT work.

Just a quick note: please, try to learn how to format code (indent lines) and use [code] tags which will preserve formatting. Because, it is kind of difficult to read bunch of lines and not knowing which oe belongs to what block. Test how to do it in our Test forum (at the bottom of the forums' list).

This, and much more, can be found in the OraFAQ Forum Guide.
Previous Topic: Handling User Sessions in Forms
Next Topic: How to Set the form status.
Goto Forum:

Current Time: Sat Oct 22 11:23:02 CDT 2016

Total time taken to generate the page: 0.10021 seconds