help with creating a stored procedures with multi cursors.

General

help with creating a stored procedures with multi cursors.

Hello all,   

I am completely new to sql and teradata(6weeks).   and have been given an assignment, which had little instruction.  

(Create a stored procedure that allows a user to select a bats manufacturer and (optionally) serial number using a stored procedure. The output should display all of the players who use the bats manufacturer. If the serial number is also provided, only display the players who use that bats manufacturer and serial number. Make sure you use a CREATE PROCEDURE call and insert this procedure into the existing database. )  this is a database through teradata that has been duplicated into my own database to be edited.  This is what I got so far and it keeps returning two errors.  I'd love help with a solution and best possible recommendation for learning sql quickly and efficiently.   I appreciate the help in advance.  and i'm sure this is the ugliest code you've seen, I aplogize. :-D

CREATE PROCEDURE batman(manuf varchar(20), bat_type varchar(4)=null)

DYNAMIC RESULT SETS 2

BEGIN

DECLARE c CURSOR FOR

SELECT playernum

FROM affiliation, bats

WHERE manuf = :manuf;

declare serial cursor for

select playernum

from affiliation

where bat_type=NULL or bat_type=:bat_type

if bat_type=NULL then open c

else open serial;

end if;

END;