calling validation in pre-insert trigger [message #482187] |
Wed, 10 November 2010 04:38 |
v1jay1
Messages: 5 Registered: October 2010 Location: INDIA
|
Junior Member |
|
|
sir
my purpose is when PRE-INSERT trigger fires validation should be done like date format , primary key in table if validation is ok then a value of text box should be set to sequence no . else it should generate message
pls reply to v1jay1@yahoo.co.in
|
|
|
|
Re: calling validation in pre-insert trigger [message #482294 is a reply to message #482188] |
Wed, 10 November 2010 22:43 |
v1jay1
Messages: 5 Registered: October 2010 Location: INDIA
|
Junior Member |
|
|
its throwing exception
PRE-INSERT trigger . Pls if you can advice code for it
requirement
Algo :-
PRE-Insert trigger
(
validate whether entries match database fields as primary key or date format
if validate success
textbox value = sequence no.
else
through message warning
)
waiting for your kind reply & cooperation
bye
|
|
|
|
|
Re: calling validation in pre-insert trigger [message #482591 is a reply to message #482187] |
Sat, 13 November 2010 04:18 |
v1jay1
Messages: 5 Registered: October 2010 Location: INDIA
|
Junior Member |
|
|
my code and error mentioned
declare
a varchar2(10);
begin
message(' test pre ' );-- just to test message put
Validate('PV'); -- block name
if not Form_Success THEN
RAISE Form_Trigger_Failure;
CLEAR_RECORD;
Execute_Query ;
else
select refno.nextval into a from dual ; -- refno is sequence no.
:block7.ref_no :=to_char(a);
end if;
end; -- objective to put sequence no. to textbox if validation success
FRM -40735 PRE-INSERT trigger raised unhandled exception ORA-06502
|
|
|
|
Re: calling validation in pre-insert trigger [message #482629 is a reply to message #482601] |
Sun, 14 November 2010 13:41 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Also this:
if not Form_Success THEN
RAISE Form_Trigger_Failure;
CLEAR_RECORD;
Execute_Query ;
Is completely wrong because:
1) If validation fails wouldn't you want the user to fix their mistakes instead of getting rid of what they've done so far?
2) RAISE Form_Trigger_Failure causes the trigger to stop executing at that point. So the following two commands can never ever run.
|
|
|
Re: calling validation in pre-insert trigger [message #482668 is a reply to message #482629] |
Mon, 15 November 2010 04:47 |
v1jay1
Messages: 5 Registered: October 2010 Location: INDIA
|
Junior Member |
|
|
thanks cookiemonster
but as you said
" 1) If validation fails wouldn't you want the user to fix their mistakes instead of getting rid of what they've done so far?
2) RAISE Form_Trigger_Failure causes the trigger to stop executing at that point. So the following two commands can never ever run "
so please tell alternative
my requirement is to check validation of a block in pre- insert trigger if its validate as per describe db fields and can insert record than i will generate sequence no.
else i will not
thanks Littlefoot
you gave me another thought too that i will avoid but
speak about my main problem pls
bye
|
|
|
Re: calling validation in pre-insert trigger [message #482671 is a reply to message #482668] |
Mon, 15 November 2010 05:00 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
v1jay1 wrote on Mon, 15 November 2010 10:47thanks cookiemonster
but as you said
" 1) If validation fails wouldn't you want the user to fix their mistakes instead of getting rid of what they've done so far?
2) RAISE Form_Trigger_Failure causes the trigger to stop executing at that point. So the following two commands can never ever run "
so please tell alternative
Raise an error. Do nothing else.
v1jay1 wrote on Mon, 15 November 2010 10:47
my requirement is to check validation of a block in pre- insert trigger if its validate as per describe db fields and can insert record than i will generate sequence no.
That requirement appears to be based on a misunderstanding about how forms works.
Whenever you try to insert or update a record in forms it will check if all the items and the record itself are marked as valid. If they aren't it'll automatically run any appropriate when-validate triggers. If they pass then the record is marked as valid and forms will proceed to the run the pre-insert/update trigger. If any fail you will get an error and processing will stop.
You do not do validation in pre-insert generally, you do it in the appropriate WHEN-VALIDATE trigger. You might want to generate the sequence no in pre-insert but nothing else.
|
|
|