does mysql stored procedures support data types like array, hash,etc?

Posted by Yang on Stack Overflow See other posts from Stack Overflow or by Yang
Published on 2010-04-22T06:08:04Z Indexed on 2010/04/22 6:13 UTC
Read the original article Hit count: 244

Filed under:
|

i am creating a mysql function which takes in a varchar and change it to a int based on a mapping table.

select name, convert_to_code(country) from users where sex = 'male'

here, the convert_to_code() function takes in a country name (e.g. Japan, Finland..) and change it to country code which is an integer (e.g. 1001, 2310..) based on a mapping table called country_maping like below:

country_name (varchar) | country_code (int)
Japan                  | 1001
Finland                | 2310
Canada                 | 8756

currently, the stored function need to select country_code from country_mapping where country_name = country_name and return the query result. is that possible to create a hash data struct in SP to optimize the process so that it will not need to perform the query for each row matches the where clause.

thanks in advance!

© Stack Overflow or respective owner

Related posts about mysql

Related posts about stored-procedures