問題:2.Author ( Ano, Name, Age, Sex ) Book ( Bno , Title , Publisher )Write ( Ano , Bno , IsFirstAuthor ),(2)給定書名,如果此書的作者只有一人,則輸出此作者名字,否則返回 NULL(函數(shù))代碼如下:Create function pangduan(@Title char(10)) returns char AsBegindeclare @anum int,@Ano char(10),@Name char(10)select @anum=count(*) from write,book where write.Bno=book.Bno and Title=@Titleif @anum=1beginselect @Ano=Ano from write,book where write.Bno=book.Bno and Title=@Titleselect @Name=Name from author where Ano=@Anoendelsebeginset @Name=nullendreturn @Name調(diào)用函數(shù)的時(shí)候,應(yīng)該返回作者名字的時(shí)候,返回了十個(gè)空格,應(yīng)該返回null的時(shí)候,返回了一個(gè)空格,end
是我的代碼有問題嗎?應(yīng)該怎么改呀?
胡子哥哥
2022-12-16 22:14:35