During the use of the DB2 database, the stored procedure is always a problem. This article will explain the paging stored procedure in the DB2 database for your reference and hope to enlighten you.
Create procedure kyjt. USP_A_FY (in ptblname varchar (1000), -- table name
In pshowname varchar (1000), -- the field name must be displayed.
In pfldname varchar (1000), -- field name (primary key of the primary table, which cannot be repeated)
In ppagesize integer, -- if the page size is 0, the first 10 million pieces of data are returned by default.
In ppageindex integer, -- page number
In pordertype integer, -- set the sorting type. If the value is not 0, the data is sorted by the primary key IN descending order)
In pstrwhere varchar (1000) -- Query condition (Note: Do not add WHERE)
)
MODIFIES SQL DATA
DETERMINISTIC
LANGUAGE SQL
BEGIN
/**//*----------------------------------------------------------------
* Copyright (C) 2006 laugh crazy
* All Rights Reserved.
*
* Process function description:
* Versatile generic paging query statement (DB2)
*
* Create an identifier: longping520@126.com (modification)
*