15
4. Create the Stored Procedure
create procedure TITLEINFO
@PUBNAME char(50),
@PUBS int output
as
begin
select titles.title,
   titles.type,
   titles.price,
   titles.pubdate,
   authors.au_lname,
   authors.au_fname
from titles,authors,titleauthor
where (titles.title_id = titleauthor.title_id and authors.au_id = titleauthor.au_id and
   titles.title like @PUBNAME )
   order by titles.title
select @PUBS = count( distinct titles.title )
from titles,authors,titleauthor
where (titles.title_id = titleauthor.title_id and authors.au_id = titleauthor.au_id and
   titles.title like @PUBNAME )
return @PUBS
end