Reputation: 1
I use a pl/sql code in a dynamic action (which is launched when I press a button). I do an update table. after the update, I want to notify to the user if the update succeed or not. I use the code :
if ( ) then
update ....
apex_application.g_print_success_message := '<span style="color:green">OK</span>';
end if;
but the code does not work. it does the update, but I do not see the notification.
thank for your help.
Hervé
Upvotes: 0
Views: 2370
Reputation: 142705
Here's how I do that:
create a stored procedure which accepts certain parameters, do stuff and puts success (or failure) message into the OUT parameter. For example,
create or replace procedure p_upd (par_empno in number, par_msg out varchar2) as
begin
update ...
where empno = par_empno;
par_msg := 'Updated ' || sql%rowcount || ' rows';
end;
P1_MSG
)create a button which - when pushed - calls a process which utilizes previously mentioned stored procedure:
p_upd (:P1_EMPNO, :P1_MSG);
finally, set this as a Success process message:
&P1_MSG.
(note leading ampersand (&
) and trailing dot (.
) - without them, it won't work. The final result will be "Updated 17 rows" message displayed on the screen (just as you see the default "Action processed" message).
That's all.
Of course, instead of calling a procedure, you can write some PL/SQL code directly into the process, but I prefer a procedure, especially when there's a lot of things to be done (I rather do that in the database).
Upvotes: 2
Reputation: 75
my suggestion is write your plsql code in process by selecting type as plsql code. from there you can set your success message as well. I also tried earlier with apex_application.g_print_success_message but it was not work for me. So I changed by process flow.
Upvotes: 0