Sujith S
asked on
Please check this - i need to give msg how many rows updated and if row no=o give error msg
DECLARE
alert VARCHAR2(100);
rowcount number;
begin
alert:=show_alert('FLAG_AL ERT');
if (alert=Alert_button2)then
exit_form;
elsif (x=Alert_button1)then
SELECT COUNT(*) INTO rowcount FROM om_customer WHERE cust_credit_ctrl_yn = :Rep_value_3;
if (rowcount>0) then
UPDATE om_customer SET cust_credit_ctrl_yn='Y'
WHERE CUST_CODE IN
(SELECT CUST_CODE FROM
(SELECT * FROM om_customer
WHERE cust_credit_ctrl_yn= :Rep_value_3
and cust_code= :Rep_value_2));
else
alert VARCHAR2(100);
rowcount number;
begin
alert:=show_alert('FLAG_AL
if (alert=Alert_button2)then
exit_form;
elsif (x=Alert_button1)then
SELECT COUNT(*) INTO rowcount FROM om_customer WHERE cust_credit_ctrl_yn = :Rep_value_3;
if (rowcount>0) then
UPDATE om_customer SET cust_credit_ctrl_yn='Y'
WHERE CUST_CODE IN
(SELECT CUST_CODE FROM
(SELECT * FROM om_customer
WHERE cust_credit_ctrl_yn= :Rep_value_3
and cust_code= :Rep_value_2));
else
ASKER
DECLARE
alert VARCHAR2(100);
rowcount number;
begin
alert:=show_alert('FLAG_AL ERT');
if (alert=Alert_button2)then
exit_form;
elsif (alert=Alert_button1)then
SELECT COUNT(*) INTO rowcount FROM om_customer WHERE cust_credit_ctrl_yn = :Rep_value_3;
if (rowcount>0) then
UPDATE om_customer SET cust_credit_ctrl_yn='Y'
WHERE CUST_CODE IN
(SELECT CUST_CODE FROM
(SELECT * FROM om_customer
WHERE cust_credit_ctrl_yn= :Rep_value_3
and cust_code= :Rep_value_2));
message(rowcount || 'rows updated',acknowledge);
else
message('No rows need to be updated',acknowledge);
end if;
end if;
END; ------ is this ok
alert VARCHAR2(100);
rowcount number;
begin
alert:=show_alert('FLAG_AL
if (alert=Alert_button2)then
exit_form;
elsif (alert=Alert_button1)then
SELECT COUNT(*) INTO rowcount FROM om_customer WHERE cust_credit_ctrl_yn = :Rep_value_3;
if (rowcount>0) then
UPDATE om_customer SET cust_credit_ctrl_yn='Y'
WHERE CUST_CODE IN
(SELECT CUST_CODE FROM
(SELECT * FROM om_customer
WHERE cust_credit_ctrl_yn= :Rep_value_3
and cust_code= :Rep_value_2));
message(rowcount || 'rows updated',acknowledge);
else
message('No rows need to be updated',acknowledge);
end if;
end if;
END; ------ is this ok
DECLARE
alert VARCHAR2(100);
rowcount number;
begin
alert:=show_alert('FLAG_ALERT');
if (alert=Alert_button2) then
exit_form;
elsif (alert=Alert_button1) then
SELECT COUNT(*) INTO rowcount FROM om_customer WHERE cust_credit_ctrl_yn = :Rep_value_3;
end if;
if (rowcount>0) then
UPDATE om_customer SET cust_credit_ctrl_yn='Y'
WHERE CUST_CODE IN
(SELECT CUST_CODE FROM
(SELECT * FROM om_customer
WHERE cust_credit_ctrl_yn= :Rep_value_3
and cust_code= :Rep_value_2));
message(rowcount || 'rows updated',acknowledge);
else
message('No rows need to be updated',acknowledge);
end if;
END;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the valuable comments
message(rowcount || ' rows updated',acknowledge);
-- or use an alert with only a ok button alert:=show_alert('INFORMA
else
message('No rows updated',acknowledge);
-- or use an alert indicating an error with only a ok button alert:=show_alert('ERROR_A
-- consider issuing a rollback and raising a trigger error
end if;