Write a query to genarate target column.Please answer me.
Advance Thanks.

Src Tgt

Q10 Quarter to 2010
Q90 Quarter to 1990
Q80 Quarter to 1980
Q74 Quarter to 1974

Answers were Sorted based on User's Feedback



Write a query to genarate target column.Please answer me. Advance Thanks. Src Tgt Q10 Quar..

Answer / megha

select
'Quarter to '||to_char((to_date('01/01/'||substr(Src,2), 'dd/mm/rrrr')),'rrrr') as "Target"
from table

Is This Answer Correct ?    9 Yes 4 No

Write a query to genarate target column.Please answer me. Advance Thanks. Src Tgt Q10 Quar..

Answer / ajit

select substr(src, 1,1 )||'uarter to '||to_char(to_date (substr(src, 2), 'rrrr'), 'yyyy') tgt
from <Table Name>

Is This Answer Correct ?    2 Yes 0 No

Write a query to genarate target column.Please answer me. Advance Thanks. Src Tgt Q10 Quar..

Answer / abhiraj

with data as (select 'Q10' as src from dual)
select
'Quarter to '||to_char((to_date('01/01/'||substr(Src,2), 'dd/mm/rrrr')),'rrrr') as "Target"
from data

Is This Answer Correct ?    1 Yes 0 No

Write a query to genarate target column.Please answer me. Advance Thanks. Src Tgt Q10 Quar..

Answer / aditya saxena @adi

select 'Quarter to '||to_char(to_date('01/01/'||substr(months,2),'dd/mm/rrrr'),'RRRR') AS Src_Tgt from (
select 'Q10' months from dual
union all
select 'Q90' from dual
union all
select 'Q80' from dual
union all
select 'Q74' from dual
)
;

Is This Answer Correct ?    0 Yes 0 No

Write a query to genarate target column.Please answer me. Advance Thanks. Src Tgt Q10 Quar..

Answer / manohar

select 'Quarter to' ||to_char(cast('1/1/'||substr(Src) as
char),'YYYY') from table

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

use of IN/ANY/ALL

5 Answers   Ramco,


Describe different types of general function used in sql?

0 Answers  


what is the functionality of the function htmlentities? : Sql dba

0 Answers  


What are the conditions an underlying table must satisfy before a cursor can be used by a positioned update or delete statement? : Transact sql

0 Answers  


What is cursor in pl sql?

0 Answers  






What type of database is sql?

0 Answers  


suppose we have values like 1 5 7 in a colum.Now we want numbers like(2 3 4 6) that exists between 1 5 7.How can we do this using sql query??

5 Answers   Keane India Ltd,


What is the cause of mutating table error and how can we solve it?

0 Answers  


Can we delete column in sql?

0 Answers  


What are records give examples?

0 Answers  


Is there a 64 bit version of ssms?

0 Answers  


I have the table like this S.No Name ID 01 Xyz 123 I want the result as 01Xyz123 How to write the query to retrieve the entire row data in a single column?

1 Answers  


Categories