[email protected],求指教!!!
这个函数只是来算一下某一读者借了多少本书
create function numBook(@readerName varchar(20))
returns int
as
begin
declare @num int;
select COUNT(*) into @num
from t_borrow,t_reader2
where t_borrow.readerId=t_reader2.readerId
and [email protected]
group by readerId;
return @num;
end
------解决方案--------------------
- SQL code
create function numBook(@readerName varchar(20))returns intasbegindeclare @num int;select @num=COUNT(*) from t_borrow,t_reader2 where t_borrow.readerId=t_reader2.readerId and [email protected]group by readerId;return @num;end--select count(*) into @num是Oracle中的语法
------解决方案--------------------