In C/++/#/Java/everything I would just my_str[desired_index] and that’s all.
But in SQL (at least Oracle) the only way I’ve found so far:
SUBSTR( my_str, desired_index, 1)
But it’s so awkward, I can’t believe in 2011 I have to do this.
Is there other way?
That is the standard way to do it in SQL. Some DBMS have a dialect of SQL that supports an alternative notation; for example, Informix supports
my_str[desired_index](and, for a three-character substring,my_str[12,14]where both values are offsets).The question is – why do you need to write that in SQL?