Thursday, May 2, 2019

Extract Vowels from a given string

SQL> SELECT LISTAGG (vowels_temp, ',') WITHIN GROUP (ORDER BY pos) AS vowels
  2    FROM (SELECT pos,
  3                 CASE
  4                    WHEN alpha IN ('a',
  5                                   'e',
  6                                   'i',
  7                                   'o',
  8                                   'u')
  9                    THEN
 10                       alpha
 11                    ELSE
 12                       NULL
 13                 END
 14                    AS vowels_temp
 15            FROM (    SELECT LEVEL AS pos, SUBSTR ('rajasekhar', LEVEL, 1) AS alpha
 16                        FROM DUAL
 17                  CONNECT BY LEVEL <= LENGTH ('rajasekhar')))
 18   WHERE vowels_temp IS NOT NULL;

VOWELS
--------------------------------------------------------------------------------
a,a,e,a

SQL>

No comments:

Post a Comment

Delete Row Button to all records of Interactive Report in Oracle Apex

 1. add 'Delete' Del column to Report Query 2. Set the Following Properties for the DEL Column Type: Link Heading: Delete Targ...