I am writing a script using DBI to execute a select query to an Oracle db. I have successfully able to capture the data but I need help to change the output.
Below is the sample output.
Type
2
6
I want to display 2=>Good and 6=>Bad
Can anyone please suggest me the Perl code to map the output?
Usually the easiest way is to change directly the values outputted by the SQL query. With Oracle you can use DECODE.
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.
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.