Replace Alternate Character in a String

SQL query to replace every alternate character in a string to capital.
Input string:- govardhana
I need output as gOvArDhAnA
And vice versa i.e, GOVARDHANA and required output as GoVaRdHaNa
Provide 2 separate queries for above scenarios

Showing Answers 1 - 6 of 6 Answers

FARIDA

  • Sep 14th, 2015
 

Code
  1.  

  2. SELECT REPLACE(govardhana,ovardhana,OvArDhAnA) FROM DUAL;

  3.  

  Was this answer useful?  Yes

Muraleedhar Reddy B

  • May 21st, 2016
 

We can perform DML on the view when
1.View is built based on a single table
2.Primary key of the table should be availbale in select clause used for view
We can not perform DML on the view when
1. View is bulit on multiple tables
However we can use trigger for DML operations on multi table view

  Was this answer useful?  Yes

RAKHEE

  • May 30th, 2016
 

Code
  1.  SELECT XMLAGG(XMLELEMENT(E,NAME||)).EXTRACT(//text()) FROM

  2.  

  3.  ( SELECT decode (mod(level,2),0, upper(SUBSTR(&A, LEVEL,1)),lower(SUBSTR(&A, LEVEL,1)))

  4.   NAME FROM DUAL CONNECT BY LEVEL <=length(&A))A;

  Was this answer useful?  Yes

Vishnu Doppalapudi

  • Jun 22nd, 2016
 

For Example consider EMP Table:
SELECT REPLACE(REGEXP_REPLACE(INITCAP(REGEXP_REPLACE(ENAME, (..), 1 )), (..), 1 ), , NULL) AS NAME FROM EMP;

  Was this answer useful?  Yes

Vishnu

  • Jun 23rd, 2016
 

For Instance consider EMP Table.

Code
  1. SELECT REPLACE(REGEXP_REPLACE(INITCAP(REGEXP_REPLACE(ENAME, (..), 1)), (..), 1),  , NULL) AS NAME FROM EMP;

  Was this answer useful?  Yes

Vishnu

  • Jun 23rd, 2016
 

Code
  1. SELECT REPLACE(INITCAP(REGEXP_REPLACE(ENAME, (..), 1 )),  , NULL) AS NAME FROM EMP;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions