You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

12 lines
323 B

  1. CREATE OR REPLACE FUNCTION retrievecustomers(l int, r int)
  2. RETURNS TABLE (customer_id int) AS $$
  3. DECLARE
  4. BEGIN
  5. IF l >= 0 OR l <= 600 OR r >= 0 OR r <= 600 THEN
  6. return QUERY SELECT customer.customer_id FROM customer ORDER BY address_id LIMIT (r-l) OFFSET l;
  7. ELSE
  8. RAISE '% %', l, r;
  9. END IF;
  10. END;
  11. $$ LANGUAGE plpgsql;