views:

36

answers:

1

Hi,

I have a stored procedure below. I intend this procedure to return the names of all the movies acted by an actor.

 Create Procedure ActorMovies(
  In ScreenName varchar(50),
  OUT Title varchar(50)
  )
  BEGIN
  Select MovieTitle INTO Title  
   From Movies Natural Join Acts 
   where Acts.ScreenName = 'ScreenName ';
 End;

I make a call like Call ActorMovies(' Jhonny Depp',@movie);

Select @move; 

The result I get is a Null set , which is not correct.I am expecting a set of movies acted by Jhonny Depp to be returned. I am not sure as to why this is happening?

+1  A: 

In your where clause, you want to remove the single quotes round ScreenName (and possibly rename it to avoid the ambiguity with the column names).

psmears
OK - it seems MySQL doesn't allow returning result sets from procedures (some SQL dialects do allow this sort of thing). What did you want to do with the results? Just return them to the client? You may have more luck removing the OUT parameter, and the INTO clause, just leaving the SELECT.
psmears