Reputation: 594
I can't seem to display the message after inserting a value into the table.
It keeps on displaying FRM-40401
instead
CREATE TABLE NUMBERS
(
NUM1 INT
);
While my code for the WHEN_BUTTON_PRESSED
is
DECLARE
VAR_VALUE INT;
BEGIN
VAR_VALUE := :MYNUMBERS.MYVALUE;
INSERT INTO NUMBERS (NUM1) VALUES (VAR_VALUE);
MESSAGE('YOU INSERTED '||var_value);
commit;
END;
Upvotes: 1
Views: 7358
Reputation: 65343
When a commit issued, FRM-40400
or FRM-40401
may arise to show transaction occured or no problem raised during transaction, respectively.
To suppress such type of messages, two methods may be considered ;
the following may be put in ON-MESSAGE
trigger at the form level :
If Message_Code in (40400, 40401) Then
null;
End If;
Alternatively the following may be put inside the trigger where commit issued
( may be inside a WHEN-BUTTON-PRESSED
trigger ) :
:system.message_level := '5';
-- to suppress all messages with severity below level 5.
commit;
:system.message_level := '0';
Where message levels are :
0 - Default value. All types of messages from the other levels of severity.
5 - Reaffirms an obvious condition.
10 - Indicates that the operator has made a procedural mistake.
15 - Declares that the operator is attempting to perform a function
for which the form is not designed.
20 - Indicates a condition where the operator cannot continue an intended
action due to a problem with a trigger or another outstanding condition.
25 - Indicates a condition that could result in the form performing incorrectly.
Upvotes: 2
Reputation: 142798
I can't seem to display the message after inserting a value into the table. It keeps on displaying ORA40401 instead
This is because of
MESSAGE('YOU INSERTED '||var_value);
commit;
If you run the form in debug mode, you'd see that message actually is displayed at the bottom of the screen, but commit
- which follows - immediately overwrites the previous message.
The simplest way to "fix" it is to display a message in a manner of an alert, i.e. a pop-up window on the screen, and that can be done by two subsequent MESSAGE
calls:
MESSAGE('YOU INSERTED '||var_value);
MESSAGE('YOU INSERTED '||var_value);
commit;
By the way, you don't need a local variable; insert the item value instead:
INSERT INTO NUMBERS (NUM1) VALUES (:MYNUMBERS.MYVALUE);
Upvotes: 1