Creating a stored procedure - MySQL

132 views Asked by At

I'm trying to create a stored procedure using Mysql workbench what i want is to know how many rows affected without display all the rows when i remove my selection no rows affected. can anyone help me please?

This my procedure :

DROP PROCEDURE IF EXISTS GetAllProducts;
     SELECT * FROM csii;
     DELIMITER |

  CREATE PROCEDURE GetAllProducts ()
  BEGIN
      DECLARE csii_id INT;
      DECLARE csii_fk_cc INT;
      DECLARE csii_s VARCHAR(255);
      DECLARE csi_p DECIMAL;
      DECLARE csi_c_a DATE;
      DECLARE csi_o_p DECIMAL;
      DECLARE csi_shi_c DECIMAL;
      DECLARE csi_xc_s VARCHAR(20);
      DECLARE csi_wei VARCHAR(20);
      DECLARE csi_fk_c_at INT;
     DECLARE csi_sta enum('a','i','d');

 SELECT 
    id, fk_cc, s, p, c_a, o_p, shi_c, xc_s, wei, fk_c_at, sta
 INTO 
    csii_id, csii_fk_cc, csii_s, csi_p, csi_c_a, csi_o_p, csi_shi_c,
     csi_xc_s, csi_wei, csi_fk_c_at, csi_sta
 FROM 
        csii
 WHERE 
        csi_sta = sta AND csi_sta = 'a';

END|
DELIMITER ;

Many thanks for any help.

1

There are 1 answers

1
Alec. On

You should just be able to add SELECT ROW_COUNT(); to the end of your query.