Monday, November 1, 2010

PostgreSQL paging

Table script
CREATE TABLE tpe_header
(
  id uuid NOT NULL,
  "year" integer NOT NULL DEFAULT 0,
  season_id uuid,
  refnumber character varying(12) NOT NULL DEFAULT ''::character varying,
  product_type_id uuid,
  gender_id uuid,
  createdby uuid,
  createddate date,
  outsoletype_id uuid,
  upper_id uuid,
  construction_id uuid,
  other_text character varying(160),
  end_client_code uuid,
  deadline_date date,
  CONSTRAINT tpe_header_id PRIMARY KEY (id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE tpe_header OWNER TO postgres;
PostgreSql Syntax
select * from tpe_header limit @page_size offset @page_index

with example value : 
select * from tpe_header limit 5 offset 1
Output:




No comments:

Post a Comment