oracle存储过程⼀个sql语句赋值两个变量,存储过程中将sql语
句结果赋值给变量...
create procedure procname
AS
declare @recount int
lect @recount=count(id) from school
--最关键在这句
lect @recount=count(id) from school
lect @recount=lect count(id) from school -- 错误:这⾥就不再需要lect了新里番
人防物防技防
t @recount=count(id) from school -- 错误这⾥只能⽤lect不能⽤t鞋印
如果school为⼀个@chart参数的话,上⾯⽅法就不适⽤了水浒传英雄
幸福是什么感觉
科幻小说怎么写
应该为:
declare @getRecordSql nvarchar(100)
t @getRecordSql='lect @recordcount=count(1) from '+@chart
exec sp_executesql @getRecordSql,N'@recordCount int output',@recordCount output
N'@recordCount int output',@recordCount output
做⼀个参数的替换,如果测试⼀下:print @recordCount的话就会显⽰⾏数
//⽰例:选择最新的5条数据从20条开始
execute A_School_getNew 5,20
--存储过程
开新
create procedure A_School_getNew @Size int, @StartIndex intASdeclare @recount intdeclare @Sql nvarchar(120)lect
名言励志
@recount=count(id) from schoolt @Sql='lect top '+convert(nvarchar,@Size)+'id,school_name from school where('+ 'ID not in(lect top '+convert(nvarchar,@recount-@startIndex+@size)+ ' id from school)) order by id desc';execute (@Sql)