1
votes

HOW TO PRINT A TO Z ALPHABETS IN QUERY WITHOUT USING TABLE

2
In Postgres or Oracle? - Ankit Bajpai
Your keyboard is broken: all characters come out as uppercase. - a_horse_with_no_name

2 Answers

0
votes

For Oracle, here's one option:

SQL> select chr(level + 64) letter
  2  from dual
  3  connect by level <= ascii('Z') - ascii('A') + 1;

LETTER
----------
A
B
C
D
E
F
<snip>
X
Y
Z

26 rows selected.

SQL>
0
votes

For Postgres:

select chr(code)
from generate_series(ascii('A'), ascii('Z')) as t(code)
order by code