Home » SQL & PL/SQL » SQL & PL/SQL » HELP PLEASE WITH THE ALPHABET :)
HELP PLEASE WITH THE ALPHABET :) [message #184525] Wed, 26 July 2006 22:09 Go to next message
dockies
Messages: 9
Registered: June 2006
Junior Member
is there any way where i can display all the letters of the alphabet using a query, i want it to be dynamic, not just by typing every letter there is in the alphabet. example result will be

A-Z DATA

A DOC
B DOC1
C DOC2
D DOC3
E .
F .
. .
. .
. .
X DOC9
Z DOC10

TNX Razz
Re: HELP PLEASE WITH THE ALPHABET :) [message #184528 is a reply to message #184525] Wed, 26 July 2006 22:49 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
SELECT let
  FROM ( SELECT    CHR ( LEVEL ) AS let
              FROM DUAL
        CONNECT BY LEVEL <= 255 )
 WHERE let BETWEEN 'A' AND 'Z'


And Yes, I know I don't have to get all 255 characters and then filter, I was just lazy and I'm leaving it as an exercise to the OP.

Ross Leishman
icon14.gif  Re: HELP PLEASE WITH THE ALPHABET :) [message #184537 is a reply to message #184528] Wed, 26 July 2006 23:55 Go to previous messageGo to next message
dockies
Messages: 9
Registered: June 2006
Junior Member
tnx rleishman it works Razz
Re: HELP PLEASE WITH THE ALPHABET :) [message #184544 is a reply to message #184528] Thu, 27 July 2006 00:19 Go to previous message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member


OR ..

SELECT CHR(ASCII('A')+LEVEL-1) FROM dual
  CONNECT BY LEVEL <=26


Dont Need to Bother about the ascii values


Thumbs Up
Rajuvan.
Previous Topic: Dynamic SQL and For Loop Question
Next Topic: primary and foreign keys problem
Goto Forum:
  


Current Time: Wed Dec 07 06:42:57 CST 2016

Total time taken to generate the page: 0.28891 seconds