Link to home
Start Free TrialLog in
Avatar of Sujith S
Sujith SFlag for United Arab Emirates

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_ALERT');
 
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
Avatar of flow01
flow01
Flag of Netherlands image

if (rowcount>0) then
    message(rowcount || '  rows updated',acknowledge);
    -- or use an alert with only a ok button   alert:=show_alert('INFORMATIONAL_ALERT');
else
    message('No rows updated',acknowledge);
    -- or use an alert indicating an error with only a ok button   alert:=show_alert('ERROR_ALERT');
    -- consider issuing a rollback and raising a trigger error  
end if;
Avatar of Sujith S

ASKER

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;
      
      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; 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the valuable comments