开发者

Convert Character to Number in Oracle

开发者 https://www.devze.com 2023-04-09 15:16 出处:网络
I have ColumnA in table. The data of each row is single character between A & H. I want my select query to return 1 for \'A\', 2 for B .... 8 for H.

I have ColumnA in table. The data of each row is single character between A & H.

I want my select query to return 1 for 'A', 2 for B .... 8 for H.

My query always returns only one row开发者_JAVA技巧. I can make a lookup table.

Anyone has better ideas to achieve the same ?


SELECT 1 + ASCII(columnA) - ASCII('A')
FROM   table
0

精彩评论

暂无评论...
验证码 换一张
取 消