开发者

Convert Character to Number in Oracle

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜