How to convert lowercase letters to uppercase and uppercase letters to lowercase in a string. (ex, AbcdEfG should convert as aBCDeFg)

Answer Posted / kunal

SELECT listagg(newstr) within GROUP (
ORDER BY rm)
FROM
(SELECT
CASE
WHEN SUBSTR('AbcdEfG',level,1)=upper(SUBSTR('AbcdEfG',level,1))
THEN lower(SUBSTR('AbcdEfG',level,1))
ELSE upper(SUBSTR('AbcdEfG',level,1))
END newstr,
rownum rm
FROM dual
CONNECT BY level <=LENGTH('AbcdEfG')
)

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is sql sequential or random?

541


What is anonymous block in sql?

640


What is query execution plan in sql?

571


What is the purpose of a sql?

530


What is group function in sql?

539






What is the difference between between and in condition operators?

537


how tsql statements can be written and submitted to the database engine? : Transact sql

535


What programs use sql?

527


What is mutating error?

509


What is the difference between cross join and natural join?

566


Explain the update statement in sql

562


How many subqueries can be nested in a statement?

505


What is native sql query?

552


What is the difference between function and procedure in pl/sql?

541


what are tables and fields? : Sql dba

580