场景:oracle分页存储过程的异常
oracle分页存储过程的错误!
点击右边红色标题查看本文完整版:oracle分页存储过程的错误!
oracle分页存储过程的错误!
下面是我的分页的存储过程,那位帮我解决一下错误啊
CREATE OR REPLACE PROCEDURE Paging_Asc_Desc (
@Tabless varchar(1000),
@PK varchar(100),
@Sort varchar(200) = NULL,
@PageNumber int = 1,
@PageSize int = 10,
@Fields varchar(1000) = '* ',
@Filter varchar(1000) = NULL,
@Group varchar(1000) = NULL)
AS
/*Find the @PK type*/
DECLARE @PKTable varchar(100)
DECLARE @PKName varchar(100)
DECLARE @type varchar(100)
DECLARE @prec int
IF CHARINDEX( '. ', @PK) > 0
BEGIN
SET @PKTable = SUBSTRING(@PK, 0, CHARINDEX( '. ',@PK))
SET @PKName = SUBSTRING(@PK, CHARINDEX( '. ',@PK) + 1, LEN(@PK))
END
ELSE
BEGIN
SET @PKTable = @Tabless
SET @PKName = @PK
END
SELECT @type=t.name, @prec=c.prec
FROM sysobjects o
JOIN syscolumns c on o.id=c.id
JOIN systypes t on c.xusertype=t.xusertype
WHERE o.name = @PKTable AND c.name = @PKName
IF CHARINDEX( 'char ', @type) > 0
SET @type = @type + '( ' + CAST(@prec AS varchar) + ') '
DECLARE @strPageSize varchar(50)
DECLARE @strRows varchar(50)
DECLARE @strFilter varchar(8000)
DECLARE @strGroup varchar(8000)
DECLARE @strSortColumn varchar(4000)
DECLARE @strSortDesc varchar(4000)
/*Default Sorting*/
IF @Sort IS NULL
SET @Sort = @PK
/*Set sorting variables.*/
IF CHARINDEX( 'DESC ',@Sort)> 0
BEGIN
SET @strSortDesc = REPLACE(@Sort, 'DESC ', 'ASC ')
SET @strSortColumn = ', ' + REPLACE(@Sort, 'DESC ', ' ')
END
ELSE
BEGIN
IF CHARINDEX( 'ASC ', @Sort) = 0
BEGIN
SET @strSortDesc = @Sort + ' DESC '
SET @strSortColumn = ', ' + @Sort
我的异常网推荐解决方案:oracle存储过程,http://www.myexceptions.net/oracle-develop/177537.html