Report internationalization - strings in SQL

0

Is there a way to use resource strings from resource bundle to replace strings inside SQL statement? For example:

SELECT

CASE WHEN company_size_id = 0 THEN 'Small'

           WHEN company_size_id = 1 THEN 'Medium'

           WHEN company_size_id = 2 THEN 'Large'

           ELSE 'Unknown'

END AS company_size
FROM companies

 

If I have a resource bundle locale.properties like:

small = 'Small'

medium = 'Medium'

large = 'Large'

 

I was hoping I could use somethinkg like $P!{parameter_name} to achieve this and write SQL this way:

SELECT

CASE WHEN company_size_id = 0 THEN $R!{small}

           WHEN company_size_id = 1 THEN $R!{medium}

           WHEN company_size_id = 2 THEN $R!{large}

           ELSE 'Unknown'

END AS company_size
FROM companies

 

I tried using $R{small} and $R!{small} syntax but it does not seem to work. Is there maybe some clever workaround or another way to achieve my goal?

 

Thanks in advance,

Bruno

bsvorinic's picture
Joined: Nov 30 2012 - 12:03pm
Last seen: 9 months 3 weeks ago

0 Answers:

No answers yet
Feedback
randomness