Skip to content

Instantly share code, notes, and snippets.

@xivSolutions
Created January 28, 2014 04:01
Show Gist options
  • Save xivSolutions/8662057 to your computer and use it in GitHub Desktop.
Save xivSolutions/8662057 to your computer and use it in GitHub Desktop.
Postgres wildcard "search" SQL Example
CREATE OR REPLACE FUNCTION searchcustomers(text) RETURNS SETOF customers AS $$
SELECT * FROM customers WHERE (last_name ILIKE $1 ||'%');
$$ LANGUAGE SQL;
SELECT * FROM searchcustomers('GR') AS t1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment