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

What is Materialized View? In What Scenario we Use Materialized View?

8515


What is varray in pl sql?

566


What is benefit of creating memory optimized table?

537


What are two statement types in sql?

536


What does count (*) mean?

521






What are the ddl commands?

533


What is out parameter used for eventhough return statement can also be used in pl/sql?

582


What is a left join?

507


Is full outer join same as cross join?

501


Can ddl statements be used in pl/sql?

591


what is 'mysqlimport'? : Sql dba

570


what is the difference between union and union all? : Sql dba

544


What is online transaction processing (oltp)?

600


explain advantages of innodb over myisam. : Sql dba

643


What is the difference between clustered and non-clustered indexes?

601