Mysql stored procedures set output parameter as total count of rows









up vote
-1
down vote

favorite
1












i am try to run a stored procedure for select rows and get total rows but it returns error.



MySql Stored Procedure :



DELIMITER $$
USE `familybase`$$

DROP PROCEDURE IF EXISTS `getAllFamilies`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `getAllFamilies`(IN `StartLimit`
INT(11),OUT `Total_rows` INT(11))
BEGIN
SELECT families.*,languages.Language
FROM families
INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId
WHERE families.Status='A'
ORDER BY families.FamilyName ASC LIMIT StartLimit,12;
SET Total_rows=SELECT COUNT(*) FROM families WHERE families.STATUS='A';
END$$
DELIMITER ;









share|improve this question























  • What is the error ? Please edit the question to add details about the error message you receive.
    – Madhur Bhaiya
    Nov 10 at 5:53










  • INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId This is completely wrong. You cannot use multiple conditions like this.
    – Madhur Bhaiya
    Nov 10 at 5:54











  • SELECT families.*,languages.Language FROM families INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId WHERE families.Status='A' ORDER BY families.FamilyName ASC LIMIT StartLimit,12; this query works but i cannot set outparameter
    – VIJAY
    Nov 10 at 5:58











  • it shows error message like, Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT (*) FROM families WHERE families.STATUS='A'; END' at line 4
    – VIJAY
    Nov 10 at 6:35










  • so any body can help to solve this problem? or ask alternative way
    – VIJAY
    Nov 10 at 6:35















up vote
-1
down vote

favorite
1












i am try to run a stored procedure for select rows and get total rows but it returns error.



MySql Stored Procedure :



DELIMITER $$
USE `familybase`$$

DROP PROCEDURE IF EXISTS `getAllFamilies`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `getAllFamilies`(IN `StartLimit`
INT(11),OUT `Total_rows` INT(11))
BEGIN
SELECT families.*,languages.Language
FROM families
INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId
WHERE families.Status='A'
ORDER BY families.FamilyName ASC LIMIT StartLimit,12;
SET Total_rows=SELECT COUNT(*) FROM families WHERE families.STATUS='A';
END$$
DELIMITER ;









share|improve this question























  • What is the error ? Please edit the question to add details about the error message you receive.
    – Madhur Bhaiya
    Nov 10 at 5:53










  • INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId This is completely wrong. You cannot use multiple conditions like this.
    – Madhur Bhaiya
    Nov 10 at 5:54











  • SELECT families.*,languages.Language FROM families INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId WHERE families.Status='A' ORDER BY families.FamilyName ASC LIMIT StartLimit,12; this query works but i cannot set outparameter
    – VIJAY
    Nov 10 at 5:58











  • it shows error message like, Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT (*) FROM families WHERE families.STATUS='A'; END' at line 4
    – VIJAY
    Nov 10 at 6:35










  • so any body can help to solve this problem? or ask alternative way
    – VIJAY
    Nov 10 at 6:35













up vote
-1
down vote

favorite
1









up vote
-1
down vote

favorite
1






1





i am try to run a stored procedure for select rows and get total rows but it returns error.



MySql Stored Procedure :



DELIMITER $$
USE `familybase`$$

DROP PROCEDURE IF EXISTS `getAllFamilies`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `getAllFamilies`(IN `StartLimit`
INT(11),OUT `Total_rows` INT(11))
BEGIN
SELECT families.*,languages.Language
FROM families
INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId
WHERE families.Status='A'
ORDER BY families.FamilyName ASC LIMIT StartLimit,12;
SET Total_rows=SELECT COUNT(*) FROM families WHERE families.STATUS='A';
END$$
DELIMITER ;









share|improve this question















i am try to run a stored procedure for select rows and get total rows but it returns error.



MySql Stored Procedure :



DELIMITER $$
USE `familybase`$$

DROP PROCEDURE IF EXISTS `getAllFamilies`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `getAllFamilies`(IN `StartLimit`
INT(11),OUT `Total_rows` INT(11))
BEGIN
SELECT families.*,languages.Language
FROM families
INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId
WHERE families.Status='A'
ORDER BY families.FamilyName ASC LIMIT StartLimit,12;
SET Total_rows=SELECT COUNT(*) FROM families WHERE families.STATUS='A';
END$$
DELIMITER ;






mysql stored-procedures






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 5:54









Madhur Bhaiya

18.8k62236




18.8k62236










asked Nov 10 at 5:40









VIJAY

155




155











  • What is the error ? Please edit the question to add details about the error message you receive.
    – Madhur Bhaiya
    Nov 10 at 5:53










  • INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId This is completely wrong. You cannot use multiple conditions like this.
    – Madhur Bhaiya
    Nov 10 at 5:54











  • SELECT families.*,languages.Language FROM families INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId WHERE families.Status='A' ORDER BY families.FamilyName ASC LIMIT StartLimit,12; this query works but i cannot set outparameter
    – VIJAY
    Nov 10 at 5:58











  • it shows error message like, Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT (*) FROM families WHERE families.STATUS='A'; END' at line 4
    – VIJAY
    Nov 10 at 6:35










  • so any body can help to solve this problem? or ask alternative way
    – VIJAY
    Nov 10 at 6:35

















  • What is the error ? Please edit the question to add details about the error message you receive.
    – Madhur Bhaiya
    Nov 10 at 5:53










  • INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId This is completely wrong. You cannot use multiple conditions like this.
    – Madhur Bhaiya
    Nov 10 at 5:54











  • SELECT families.*,languages.Language FROM families INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId WHERE families.Status='A' ORDER BY families.FamilyName ASC LIMIT StartLimit,12; this query works but i cannot set outparameter
    – VIJAY
    Nov 10 at 5:58











  • it shows error message like, Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT (*) FROM families WHERE families.STATUS='A'; END' at line 4
    – VIJAY
    Nov 10 at 6:35










  • so any body can help to solve this problem? or ask alternative way
    – VIJAY
    Nov 10 at 6:35
















What is the error ? Please edit the question to add details about the error message you receive.
– Madhur Bhaiya
Nov 10 at 5:53




What is the error ? Please edit the question to add details about the error message you receive.
– Madhur Bhaiya
Nov 10 at 5:53












INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId This is completely wrong. You cannot use multiple conditions like this.
– Madhur Bhaiya
Nov 10 at 5:54





INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId This is completely wrong. You cannot use multiple conditions like this.
– Madhur Bhaiya
Nov 10 at 5:54













SELECT families.*,languages.Language FROM families INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId WHERE families.Status='A' ORDER BY families.FamilyName ASC LIMIT StartLimit,12; this query works but i cannot set outparameter
– VIJAY
Nov 10 at 5:58





SELECT families.*,languages.Language FROM families INNER JOIN languages ON languages.LanguageId=families.Language_LanguageId=Language_LanguageId WHERE families.Status='A' ORDER BY families.FamilyName ASC LIMIT StartLimit,12; this query works but i cannot set outparameter
– VIJAY
Nov 10 at 5:58













it shows error message like, Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT (*) FROM families WHERE families.STATUS='A'; END' at line 4
– VIJAY
Nov 10 at 6:35




it shows error message like, Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT (*) FROM families WHERE families.STATUS='A'; END' at line 4
– VIJAY
Nov 10 at 6:35












so any body can help to solve this problem? or ask alternative way
– VIJAY
Nov 10 at 6:35





so any body can help to solve this problem? or ask alternative way
– VIJAY
Nov 10 at 6:35


















active

oldest

votes











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',
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%2f53236302%2fmysql-stored-procedures-set-output-parameter-as-total-count-of-rows%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f53236302%2fmysql-stored-procedures-set-output-parameter-as-total-count-of-rows%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

How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

Syphilis

Darth Vader #20