Advertisement
fahadkalil

plpgsql_func_ret_table

Oct 17th, 2024 (edited)
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PostgreSQL 0.29 KB | Source Code | 0 0
  1. CREATE OR REPLACE FUNCTION GET_FILM (P_PATTERN VARCHAR)
  2. RETURNS TABLE (FILM_TITLE VARCHAR, FILM_RELEASE_YEAR INT)
  3. AS $$
  4. BEGIN
  5.     RETURN QUERY
  6.     SELECT title, CAST(release_year AS INTEGER)
  7.     FROM
  8.         film
  9.     WHERE
  10.         title ILIKE p_pattern;
  11. END;
  12. $$ LANGUAGE 'plpgsql';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement