Home » Developer & Programmer » Forms » Unable to solve foreign Key problem (Oracle Forms 10g)
Unable to solve foreign Key problem [message #542582] Wed, 08 February 2012 02:17 Go to next message
new_oracle2011
Messages: 174
Registered: March 2011
Location: Qatar
Senior Member
Actually, i want to insert into some table having the foreign key from the master table. I created following procedure
v_rec_id number;
v_sort_order number;
BEGIN
   v_rec_id := get_rec_id;
   v_sort_order := get_sort_order(p_report_no, p_report_yr);
    insert into assist_report_requests (rec_id, report_yr, report_no, req_no, req_yr, create_user, create_date,print_counter, sort_order) 
                                values (v_rec_id, p_report_no, p_report_yr, p_req_no, p_req_yr, user, sysdate,0, v_sort_order);

commit;
exception when others then
    message('Error Code: '||sqlcode||' Error Message: '||sqlerrm);
    raise form_trigger_failure;
END;


I have placed everywhere in the form like in POST-INSERT Trigger, Key-Commit Trigger (On block level), POST-FORM-COMMIT Trigger, POST-DATABASE-COMMIT (on form level). but still the problem is coming.
Is there some other way of doing this or some other trigger which i have to consider.
Re: Unable to solve foreign Key problem [message #542583 is a reply to message #542582] Wed, 08 February 2012 02:22 Go to previous messageGo to next message
new_oracle2011
Messages: 174
Registered: March 2011
Location: Qatar
Senior Member
My bad. I was putting wrong value in the column. Now, it is solved Smile
Re: Unable to solve foreign Key problem [message #542584 is a reply to message #542582] Wed, 08 February 2012 02:25 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You say that you have a problem, but - you never explained what problem is it? Any error? If so, which one (ORA-xxxxx, FRM-xxxxx)?

Also, remove that silly, useless WHEN OTHERS.
Re: Unable to solve foreign Key problem [message #542587 is a reply to message #542584] Wed, 08 February 2012 02:41 Go to previous messageGo to next message
new_oracle2011
Messages: 174
Registered: March 2011
Location: Qatar
Senior Member
Sorry. I should have mentioned the error codes and I will do in future. Thanks for the correction. The error which i was getting was ORA - 02291, FRM - 40735

By the way, it will be a great help if you guide me what to put in exception separately when used for select, insert, delete, update statement.
Re: Unable to solve foreign Key problem [message #542590 is a reply to message #542587] Wed, 08 February 2012 02:57 Go to previous message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
Don't put exception handlers at all unless it's an exception you expect and decide isn't a problem - like no_data_found.
See WHEN OTHERS

[Updated on: Wed, 08 February 2012 02:58]

Report message to a moderator

Previous Topic: How to call c++ code in forms 6i
Next Topic: I Need help ?
Goto Forum:
  


Current Time: Sat Jul 13 14:22:12 CDT 2024