How to return multiple rows using Stored Procedure

inba

I am new to Stored Procedure. I have written a query to get multiple rows. But I am getting error like

Error Code: 1172. Result consisted of more than one row.

Should I use CURSOR type?

Here my query and table structure.

My table structure is:

+---+------+------+---------+
|id | name | class| section |
+---+------+------+---------+
|1  |abc   |5     | A       |
|2  |cdef  |5     | B       |
|3  |hikl  |5     | A       |
|4  |xyz   |5     | A       |
+---+------+------+---------+

My Stored procedure query is

CREATE DEFINER=`root`@`localhost` PROCEDURE `mulitiOut`(out namee VARCHAR(50))
BEGIN
select name into @namee from mytable where section = A;
END

How can I return all the name related to section A.

vhu

You can return a result set directly from a procedure:

CREATE DEFINER=`root`@`localhost` PROCEDURE `mulitiOut`()
BEGIN
 SELECT name FROM mytable WHERE section = A;
END

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to return multiple rows using Stored Procedure

From Dev

Return multiple rows from a recursive stored procedure

From Dev

How to return multiple resultset from a stored procedure using cte?

From Dev

how to pass multiple values using stored procedure?

From Dev

Retrieving multiple rows from stored procedure using c#

From Dev

How to return multiple values from stored procedure within tsql query

From Dev

How to return multiple varchar from a stored procedure where condition is met

From Dev

How to return multiple values from stored procedure within tsql query

From Dev

Stored Procedure to return specific rows plsql

From Dev

How to call a stored procedure and get return value in Slick (using Scala)

From Dev

How to return xml from a stored procedure using T-SQL

From Dev

How return value exec in table function without using a stored procedure?

From Dev

Stored Procedure to insert multiple rows from XML

From Dev

Oracle Stored Procedure: Returning a Multiple Rows

From Dev

How to pass multiple parameters to stored procedure using pdo in php

From Dev

How many rows were updated by a stored procedure

From Dev

How to return ID from stored procedure?

From Dev

How to read stored procedure output and return it as list

From Dev

How to get return value from stored procedure

From Dev

How to set a value with the return value of a stored procedure

From Dev

How to return no records found from a stored procedure

From Dev

How to return a value from a stored procedure to EF

From Dev

how to return decimal value from stored procedure

From Dev

How to get return value from stored procedure

From Dev

How to return ID from stored procedure?

From Dev

Save into multiple tables using stored procedure

From Dev

multiple insert query using stored procedure NOT WORKING

From Dev

Save into multiple tables using stored procedure

From Dev

C# - Oracle Stored Procedure return RefCursor without rows

Related Related

  1. 1

    How to return multiple rows using Stored Procedure

  2. 2

    Return multiple rows from a recursive stored procedure

  3. 3

    How to return multiple resultset from a stored procedure using cte?

  4. 4

    how to pass multiple values using stored procedure?

  5. 5

    Retrieving multiple rows from stored procedure using c#

  6. 6

    How to return multiple values from stored procedure within tsql query

  7. 7

    How to return multiple varchar from a stored procedure where condition is met

  8. 8

    How to return multiple values from stored procedure within tsql query

  9. 9

    Stored Procedure to return specific rows plsql

  10. 10

    How to call a stored procedure and get return value in Slick (using Scala)

  11. 11

    How to return xml from a stored procedure using T-SQL

  12. 12

    How return value exec in table function without using a stored procedure?

  13. 13

    Stored Procedure to insert multiple rows from XML

  14. 14

    Oracle Stored Procedure: Returning a Multiple Rows

  15. 15

    How to pass multiple parameters to stored procedure using pdo in php

  16. 16

    How many rows were updated by a stored procedure

  17. 17

    How to return ID from stored procedure?

  18. 18

    How to read stored procedure output and return it as list

  19. 19

    How to get return value from stored procedure

  20. 20

    How to set a value with the return value of a stored procedure

  21. 21

    How to return no records found from a stored procedure

  22. 22

    How to return a value from a stored procedure to EF

  23. 23

    how to return decimal value from stored procedure

  24. 24

    How to get return value from stored procedure

  25. 25

    How to return ID from stored procedure?

  26. 26

    Save into multiple tables using stored procedure

  27. 27

    multiple insert query using stored procedure NOT WORKING

  28. 28

    Save into multiple tables using stored procedure

  29. 29

    C# - Oracle Stored Procedure return RefCursor without rows

HotTag

Archive