Home » Developer & Programmer » Forms » Question with Pre-Insert trigger (Forms 11G)
Question with Pre-Insert trigger [message #671418] Wed, 29 August 2018 03:31 Go to next message
RaShi.Raj
Messages: 81
Registered: May 2014
Location: Bangalore
Member
Hi All,

I have a multi-record DB block. Have written pre-insert trigger which assigns mandatory columns with values. It all works fine when I enter any number of rows and do a commit but throws 'Mandatory column missing error' in this scenario - I add 2 rows -> Delete the 2nd row (DELETE_RECORD) -> Commit.
PRE-INSERT trigger is firing for this particular record but there are NULL values assigned to items which are in PI trigger. Am I missing something?

Thanks,
Rashi
Re: Question with Pre-Insert trigger [message #671454 is a reply to message #671418] Thu, 30 August 2018 03:11 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
I'm pretty sure it shouldn't do that.
Try running the form in debug mode to see if any other triggers are firing.
Re: Question with Pre-Insert trigger [message #671461 is a reply to message #671418] Thu, 30 August 2018 06:30 Go to previous messageGo to next message
RaShi.Raj
Messages: 81
Registered: May 2014
Location: Bangalore
Member
This is what I have in pre-insert trigger. Right after assigning I'm displaying them but they all show NULL. However, values which are entered via screen for this record shows.

SELECT F_SEQ.nextval INTO :block_details.id FROM dual;
:block_details.item1:= :nbt_blk.item1;
:block_details.from_date := TRUNC(SYSDATE);
:block_details.to_date := TRUNC(SYSDATE);

-- Below messages shows NULL for each item
message('ID '||:block_details.id);
message('ITEM 1'||:block_details.item1);
message('EFD '||:block_details.from_date);
message('ETD '||:block_details.to_date);


I'll see if any other trigger causing this.

Thanks You
Re: Question with Pre-Insert trigger [message #671465 is a reply to message #671461] Thu, 30 August 2018 08:29 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you delete, pre-insert should not fire.
If it's new record then delete should act like clear_record.
Re: Question with Pre-Insert trigger [message #671467 is a reply to message #671465] Thu, 30 August 2018 09:07 Go to previous messageGo to next message
RaShi.Raj
Messages: 81
Registered: May 2014
Location: Bangalore
Member
Yes, PRE-INSERT is firing on commit (not delete_record). I mentioned delete_record because this error occurs only when I create 2 (or more) rows and delete a row (using delete_record before it is committed/posted) and then click a button which commits.
I got rid of all block level and item level triggers except auto-generated triggers on master-detail block but still the error persist.
What I'm not able to understand is why fields that are assigned value is showing NULL in the same block of code OR why they weren't assigned any values.

Re: Question with Pre-Insert trigger [message #671510 is a reply to message #671467] Mon, 03 September 2018 07:53 Go to previous messageGo to next message
RaShi.Raj
Messages: 81
Registered: May 2014
Location: Bangalore
Member
My bad...I was setting insert_allowed to FALSE for that block in a procedure that is called from 'Delete' button. This was the reason why I was not able to assign values in pre-insert after 'Delete'.

Thank you

[Updated on: Mon, 03 September 2018 07:53]

Report message to a moderator

Re: Question with Pre-Insert trigger [message #671511 is a reply to message #671510] Mon, 03 September 2018 08:34 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Ok, now I understand what was happening.
Glad you found it.
Re: Question with Pre-Insert trigger [message #671516 is a reply to message #671511] Mon, 03 September 2018 10:23 Go to previous messageGo to next message
RaShi.Raj
Messages: 81
Registered: May 2014
Location: Bangalore
Member
Just wondering if that shouldn't have thrown some "FRM" error for trying to assign value to a item in a block where insert_allowed property is FALSE.
Re: Question with Pre-Insert trigger [message #671543 is a reply to message #671516] Wed, 05 September 2018 03:26 Go to previous message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
My gut says it should have, but I'm not in a position to check.
Previous Topic: FRM-40654: Record has been updated by another user. Re-query to see change
Next Topic: utl_tcp Error
Goto Forum:
  


Current Time: Tue May 26 13:42:59 CDT 2020