MYSQL Procedure not getting called The Next CEO of Stack OverflowCan I concatenate multiple MySQL rows into one field?Should I use the datetime or timestamp data type in MySQL?Insert results of a stored procedure into a temporary tableMysql Call Stored procedure from another stored procedureHow to get a list of MySQL user accountsInsert into a MySQL table or update if existsHow to reset AUTO_INCREMENT in MySQL?How to get the sizes of the tables of a MySQL database?MySQL error code: 1175 during UPDATE in MySQL WorkbenchHow to import an SQL file using the command line in MySQL?

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Can Sneak Attack be used when hitting with an improvised weapon?

Why did early computer designers eschew integers?

From jafe to El-Guest

Why is information "lost" when it got into a black hole?

It is correct to match light sources with the same color temperature?

Which Pokemon have a special animation when running with them out of their pokeball?

Ising model simulation

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

What flight has the highest ratio of timezone difference to flight time?

Inductor and Capacitor in Parallel

What steps are necessary to read a Modern SSD in Medieval Europe?

Is French Guiana a (hard) EU border?

Is it correct to say moon starry nights?

Airplane gently rocking its wings during whole flight

Players Circumventing the limitations of Wish

What's the commands of Cisco query bgp neighbor table, bgp table and router table?

How to use ReplaceAll on an expression that contains a rule

What would be the main consequences for a country leaving the WTO?

What are the unusually-enlarged wing sections on this P-38 Lightning?

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

What is the difference between "hamstring tendon" and "common hamstring tendon"?

My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?

Is there a difference between "Fahrstuhl" and "Aufzug"?



MYSQL Procedure not getting called



The Next CEO of Stack OverflowCan I concatenate multiple MySQL rows into one field?Should I use the datetime or timestamp data type in MySQL?Insert results of a stored procedure into a temporary tableMysql Call Stored procedure from another stored procedureHow to get a list of MySQL user accountsInsert into a MySQL table or update if existsHow to reset AUTO_INCREMENT in MySQL?How to get the sizes of the tables of a MySQL database?MySQL error code: 1175 during UPDATE in MySQL WorkbenchHow to import an SQL file using the command line in MySQL?










0















The Following procedure after getting called, shows up error "The Result return more than one row" where the input value given is just one parameter.



 DELIMITER $$
CREATE PROCEDURE p( IN en int,OUT ename int, OUT incr_sal int, OUT s_sal
int, OUT count1 int)
BEGIN

DECLARE sal INT DEFAULT 0;
DECLARE cnt int DEFAULT 0;
DECLARE emp_name int DEFAULT 0;

SELECT `ename`,`salary` INTO sal, emp_name
FROM works w
WHERE `ename`=en;

SELECT COUNT(m.empname) INTO cnt
FROM manages m
WHERE m.empname=en
GROUP BY m.empname;

SET @ename=emp_name; SET @incr_sal=sal;

IF sal>50000 && cnt>2 THEN SET sal=sal+((sal*5)/100);
ELSEIF sal>50000 && sal<60000 && cnt>=1 THEN SET sal=sal+((sal*2)/100);
ELSEIF sal>10000 && cnt=0 THEN SET sal=sal+((sal*1)/100);
end IF;

SET @s_sal=sal;
SET @count1=cnt;

SELECT @ename,@incr_sal,@s_sal,@count1;
END $$
DELIMITER ;

CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt);









share|improve this question




























    0















    The Following procedure after getting called, shows up error "The Result return more than one row" where the input value given is just one parameter.



     DELIMITER $$
    CREATE PROCEDURE p( IN en int,OUT ename int, OUT incr_sal int, OUT s_sal
    int, OUT count1 int)
    BEGIN

    DECLARE sal INT DEFAULT 0;
    DECLARE cnt int DEFAULT 0;
    DECLARE emp_name int DEFAULT 0;

    SELECT `ename`,`salary` INTO sal, emp_name
    FROM works w
    WHERE `ename`=en;

    SELECT COUNT(m.empname) INTO cnt
    FROM manages m
    WHERE m.empname=en
    GROUP BY m.empname;

    SET @ename=emp_name; SET @incr_sal=sal;

    IF sal>50000 && cnt>2 THEN SET sal=sal+((sal*5)/100);
    ELSEIF sal>50000 && sal<60000 && cnt>=1 THEN SET sal=sal+((sal*2)/100);
    ELSEIF sal>10000 && cnt=0 THEN SET sal=sal+((sal*1)/100);
    end IF;

    SET @s_sal=sal;
    SET @count1=cnt;

    SELECT @ename,@incr_sal,@s_sal,@count1;
    END $$
    DELIMITER ;

    CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt);









    share|improve this question


























      0












      0








      0








      The Following procedure after getting called, shows up error "The Result return more than one row" where the input value given is just one parameter.



       DELIMITER $$
      CREATE PROCEDURE p( IN en int,OUT ename int, OUT incr_sal int, OUT s_sal
      int, OUT count1 int)
      BEGIN

      DECLARE sal INT DEFAULT 0;
      DECLARE cnt int DEFAULT 0;
      DECLARE emp_name int DEFAULT 0;

      SELECT `ename`,`salary` INTO sal, emp_name
      FROM works w
      WHERE `ename`=en;

      SELECT COUNT(m.empname) INTO cnt
      FROM manages m
      WHERE m.empname=en
      GROUP BY m.empname;

      SET @ename=emp_name; SET @incr_sal=sal;

      IF sal>50000 && cnt>2 THEN SET sal=sal+((sal*5)/100);
      ELSEIF sal>50000 && sal<60000 && cnt>=1 THEN SET sal=sal+((sal*2)/100);
      ELSEIF sal>10000 && cnt=0 THEN SET sal=sal+((sal*1)/100);
      end IF;

      SET @s_sal=sal;
      SET @count1=cnt;

      SELECT @ename,@incr_sal,@s_sal,@count1;
      END $$
      DELIMITER ;

      CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt);









      share|improve this question
















      The Following procedure after getting called, shows up error "The Result return more than one row" where the input value given is just one parameter.



       DELIMITER $$
      CREATE PROCEDURE p( IN en int,OUT ename int, OUT incr_sal int, OUT s_sal
      int, OUT count1 int)
      BEGIN

      DECLARE sal INT DEFAULT 0;
      DECLARE cnt int DEFAULT 0;
      DECLARE emp_name int DEFAULT 0;

      SELECT `ename`,`salary` INTO sal, emp_name
      FROM works w
      WHERE `ename`=en;

      SELECT COUNT(m.empname) INTO cnt
      FROM manages m
      WHERE m.empname=en
      GROUP BY m.empname;

      SET @ename=emp_name; SET @incr_sal=sal;

      IF sal>50000 && cnt>2 THEN SET sal=sal+((sal*5)/100);
      ELSEIF sal>50000 && sal<60000 && cnt>=1 THEN SET sal=sal+((sal*2)/100);
      ELSEIF sal>10000 && cnt=0 THEN SET sal=sal+((sal*1)/100);
      end IF;

      SET @s_sal=sal;
      SET @count1=cnt;

      SELECT @ename,@incr_sal,@s_sal,@count1;
      END $$
      DELIMITER ;

      CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt);






      mysql sql mysql-workbench






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 10 at 4:35







      Aadi

















      asked Mar 7 at 18:09









      AadiAadi

      33




      33






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Execute query seperately and see the result



          SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en;


          Are you expected more than one row here or just one. If expecting one then just add limit 1 to query as :



           SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en limit 1;





          share|improve this answer























          • Thank You for your answer. I did try this. But i am getting the same error saying SQL query: CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt) MySQL said: Documentation #1172 - Result consisted of more than one row

            – Aadi
            Mar 10 at 4:41












          • just to know the input parameter is " IN en INT" , "OUT ename INT" , "OUT incr_sal INT", "OUT s_sal INT" , "OUT count1 INT" . I did not use VARCHAR for 'en' because any the procedure which I am using doesn't work with VARCHAR only INT and BLOB.

            – Aadi
            Mar 10 at 4:46












          • Ok so now its working or not. But you have mentioned the error was 'The Result return more than one row' . If you were doing above mistake then then error would be 'Error Code: 1366. Incorrect integer value: 'Sam' for column 'en' at row 1.'

            – Vishal Pawar
            Mar 10 at 13:01











          • Is there any reason your procedure not working with varchar . What error your getting on use. Is it a syntax error.

            – Vishal Pawar
            Mar 10 at 13:04











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050262%2fmysql-procedure-not-getting-called%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Execute query seperately and see the result



          SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en;


          Are you expected more than one row here or just one. If expecting one then just add limit 1 to query as :



           SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en limit 1;





          share|improve this answer























          • Thank You for your answer. I did try this. But i am getting the same error saying SQL query: CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt) MySQL said: Documentation #1172 - Result consisted of more than one row

            – Aadi
            Mar 10 at 4:41












          • just to know the input parameter is " IN en INT" , "OUT ename INT" , "OUT incr_sal INT", "OUT s_sal INT" , "OUT count1 INT" . I did not use VARCHAR for 'en' because any the procedure which I am using doesn't work with VARCHAR only INT and BLOB.

            – Aadi
            Mar 10 at 4:46












          • Ok so now its working or not. But you have mentioned the error was 'The Result return more than one row' . If you were doing above mistake then then error would be 'Error Code: 1366. Incorrect integer value: 'Sam' for column 'en' at row 1.'

            – Vishal Pawar
            Mar 10 at 13:01











          • Is there any reason your procedure not working with varchar . What error your getting on use. Is it a syntax error.

            – Vishal Pawar
            Mar 10 at 13:04















          1














          Execute query seperately and see the result



          SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en;


          Are you expected more than one row here or just one. If expecting one then just add limit 1 to query as :



           SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en limit 1;





          share|improve this answer























          • Thank You for your answer. I did try this. But i am getting the same error saying SQL query: CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt) MySQL said: Documentation #1172 - Result consisted of more than one row

            – Aadi
            Mar 10 at 4:41












          • just to know the input parameter is " IN en INT" , "OUT ename INT" , "OUT incr_sal INT", "OUT s_sal INT" , "OUT count1 INT" . I did not use VARCHAR for 'en' because any the procedure which I am using doesn't work with VARCHAR only INT and BLOB.

            – Aadi
            Mar 10 at 4:46












          • Ok so now its working or not. But you have mentioned the error was 'The Result return more than one row' . If you were doing above mistake then then error would be 'Error Code: 1366. Incorrect integer value: 'Sam' for column 'en' at row 1.'

            – Vishal Pawar
            Mar 10 at 13:01











          • Is there any reason your procedure not working with varchar . What error your getting on use. Is it a syntax error.

            – Vishal Pawar
            Mar 10 at 13:04













          1












          1








          1







          Execute query seperately and see the result



          SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en;


          Are you expected more than one row here or just one. If expecting one then just add limit 1 to query as :



           SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en limit 1;





          share|improve this answer













          Execute query seperately and see the result



          SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en;


          Are you expected more than one row here or just one. If expecting one then just add limit 1 to query as :



           SELECT `ename`,`salary` INTO sal, emp_name 
          FROM works w
          WHERE `ename`=en limit 1;






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 18:27









          Vishal PawarVishal Pawar

          863




          863












          • Thank You for your answer. I did try this. But i am getting the same error saying SQL query: CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt) MySQL said: Documentation #1172 - Result consisted of more than one row

            – Aadi
            Mar 10 at 4:41












          • just to know the input parameter is " IN en INT" , "OUT ename INT" , "OUT incr_sal INT", "OUT s_sal INT" , "OUT count1 INT" . I did not use VARCHAR for 'en' because any the procedure which I am using doesn't work with VARCHAR only INT and BLOB.

            – Aadi
            Mar 10 at 4:46












          • Ok so now its working or not. But you have mentioned the error was 'The Result return more than one row' . If you were doing above mistake then then error would be 'Error Code: 1366. Incorrect integer value: 'Sam' for column 'en' at row 1.'

            – Vishal Pawar
            Mar 10 at 13:01











          • Is there any reason your procedure not working with varchar . What error your getting on use. Is it a syntax error.

            – Vishal Pawar
            Mar 10 at 13:04

















          • Thank You for your answer. I did try this. But i am getting the same error saying SQL query: CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt) MySQL said: Documentation #1172 - Result consisted of more than one row

            – Aadi
            Mar 10 at 4:41












          • just to know the input parameter is " IN en INT" , "OUT ename INT" , "OUT incr_sal INT", "OUT s_sal INT" , "OUT count1 INT" . I did not use VARCHAR for 'en' because any the procedure which I am using doesn't work with VARCHAR only INT and BLOB.

            – Aadi
            Mar 10 at 4:46












          • Ok so now its working or not. But you have mentioned the error was 'The Result return more than one row' . If you were doing above mistake then then error would be 'Error Code: 1366. Incorrect integer value: 'Sam' for column 'en' at row 1.'

            – Vishal Pawar
            Mar 10 at 13:01











          • Is there any reason your procedure not working with varchar . What error your getting on use. Is it a syntax error.

            – Vishal Pawar
            Mar 10 at 13:04
















          Thank You for your answer. I did try this. But i am getting the same error saying SQL query: CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt) MySQL said: Documentation #1172 - Result consisted of more than one row

          – Aadi
          Mar 10 at 4:41






          Thank You for your answer. I did try this. But i am getting the same error saying SQL query: CALL p('Sam',@ename,@incr_sal,@s_sal,@cnt) MySQL said: Documentation #1172 - Result consisted of more than one row

          – Aadi
          Mar 10 at 4:41














          just to know the input parameter is " IN en INT" , "OUT ename INT" , "OUT incr_sal INT", "OUT s_sal INT" , "OUT count1 INT" . I did not use VARCHAR for 'en' because any the procedure which I am using doesn't work with VARCHAR only INT and BLOB.

          – Aadi
          Mar 10 at 4:46






          just to know the input parameter is " IN en INT" , "OUT ename INT" , "OUT incr_sal INT", "OUT s_sal INT" , "OUT count1 INT" . I did not use VARCHAR for 'en' because any the procedure which I am using doesn't work with VARCHAR only INT and BLOB.

          – Aadi
          Mar 10 at 4:46














          Ok so now its working or not. But you have mentioned the error was 'The Result return more than one row' . If you were doing above mistake then then error would be 'Error Code: 1366. Incorrect integer value: 'Sam' for column 'en' at row 1.'

          – Vishal Pawar
          Mar 10 at 13:01





          Ok so now its working or not. But you have mentioned the error was 'The Result return more than one row' . If you were doing above mistake then then error would be 'Error Code: 1366. Incorrect integer value: 'Sam' for column 'en' at row 1.'

          – Vishal Pawar
          Mar 10 at 13:01













          Is there any reason your procedure not working with varchar . What error your getting on use. Is it a syntax error.

          – Vishal Pawar
          Mar 10 at 13:04





          Is there any reason your procedure not working with varchar . What error your getting on use. Is it a syntax error.

          – Vishal Pawar
          Mar 10 at 13:04



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55050262%2fmysql-procedure-not-getting-called%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко