Hi, I have atable with a "name" column, and I order it usually order by regexp_match(name, 'regex1'), regexp_match(name, 'regex2') orthe equivalent order by (regexp_match(name, 'regex1'))[1], (regexp_match(name, 'regex2'))[2] Is there a wayto create a function so the statement could read select ... order by myfunc(name) Best regards Wolfgang