How to convert lowercase letters to uppercase and uppercase letters to lowercase in a string. (ex, AbcdEfG should convert as aBCDeFg)
Answers were Sorted based on User's Feedback
easiest way is to use the condition-
for(i=0;s[i]!='';i++)
{
if(s[i]>=65 && s[i]<=90) //Caps ASCII-65-90(60+32=97-----90+32=122)
s[i]=s[i]+32;
if(s[i]>=97 && s[i]<=122) // Small ASCII-97-122(97-32=65-----122-32=90)
s[i]=s[i]-32;
}
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / 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 |
Answer / debashis mohanty
Select 'AbcdEfG',LOWER(SUBSTR('AbcdEfG',1,1))||UPPER(SUBSTR('AbcdEfG',2,3))||LOWER(SUBSTR('AbcdEfG',5,1))||UPPER(SUBSTR('AbcdEfG',6,1))||LOWER(SUBSTR('AbcdEfG',7,1)) From Dual
Is This Answer Correct ? | 0 Yes | 1 No |
What are wait events. Describe the wait event tables.
What steps server process has to take to execute an update statement?
What is the size of partition table?
Differentiate between pl/sql and sql?
Can I learn sql in a week?
What is difference between procedure and trigger?
What are the types of queries in sql?
I have 2 Databases. How can create a table in particular database? How can i know the list of tables presented each database?( in oracle 10g)
What is the difference between sql and mysql?
Explain the advantages and disadvantages of stored procedure?
How does pl sql work?
How does rowid help in running a query faster?