0

I have created a procedure in mysql having multiple select statements in it.

Here is my code :

DELIMITER $$

USE `databasename`$$

DROP PROCEDURE IF EXISTS `wholeProjectDetails`$$

CREATE DEFINER=`databasename`@`localhost` PROCEDURE `wholeProjectDetails`(IN givenpid INT)
BEGIN
select * from projects where projectid=givenpid;
select * from projects where projectid<>givenpid;
END$$

DELIMITER ;

When i called this procedure using statement :

call wholeProjectDetails(2);

it is displaying only first statement's results, i want that it will display both statement's records.

Please let me know what i am doing wrong?

Thanks

deepak.mr888
  • 349
  • 2
  • 11
  • 26

1 Answers1

0

When you call this procedure, MySQL creates two result-sets. Now, you need to get these two result-sets using your MySQL client. Read information about client you use, does it support this feature? For example, in .NET you can use IDataReader.NextResult Method, in mysqli - mysqli::next_result function, and so on.

If you want just to view these result-sets, you can install one of MySQL GUI tools, there are free ones.

Devart
  • 119,203
  • 23
  • 166
  • 186