Home » Developer & Programmer » Forms » code
code [message #385244] |
Sun, 08 February 2009 04:00 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
imuharram
Messages: 48 Registered: January 2009
|
Member |
|
|
I need someone to check the code below and tell me why isn't the Insert statment working:
declare
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;
begin
a:=:global.copy_no;
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;
:global.copy_no:=nvl(n,0)+1;
insert into wo_trans values (:global.wo_no,:global.copy_no,:wo_trans.emp_no,
:wo_trans.wo_type_no,0,sysdate,0,0,:wo_trans.title,
:control2.modify_txt,null); /* Q.2 --> doesn't insert */
commit;
open c;
loop
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 */
commit;
end loop;
close c;
go_block('wo_trans');
end;
[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 Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 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.
|
|
|
Goto Forum:
Current Time: Sun Feb 09 10:04:14 CST 2025
|