Usually the easiest way is to change directly the values outputted by the SQL query. With Oracle you can use DECODE.
SELECT DECODE(MY_TYPE, 2, 'TWO', 6, 'SIX', 'DEFAULT_VALUE') FROM MY_TABLE
The standard SQL way is to use a CASE conditional expression. It is a little more verbose, but more powerful and more portable. It works for example in Oracle, PostgreSQL and MS-SQL.
SELECT
CASE
WHEN MY_TYPE = 2 THEN 'TWO'
WHEN MY_TYPE = 6 THEN 'SIX'
ELSE 'DEFAULT_VALUE'
END CASE
FROM MY_TABLE
If you still want to do it in Perl, you might create a Hash. The code sample is quite trivial, and well documented in the link I provided.