Created
January 28, 2014 04:01
-
-
Save xivSolutions/8662057 to your computer and use it in GitHub Desktop.
Postgres wildcard "search" SQL Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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