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

How can we Get the Updated Rows? ie, There is 100s of Rows i updated the Rows who have salary 5000. then i want to select the Updated Rows. How can we achieve it?

4 Answers   Fidelity, KCP,


what is the command for user data type?

2 Answers  


how to calculate the difference between two dates? : Sql dba

0 Answers  


How do you optimize a stored procedure in sql?

0 Answers  


write a pl/sql function if enter a value=0 then output value=1 and vise verse with out using if and case statements.

3 Answers   Zensar,






What are data types in pl sql?

0 Answers  


Can We write bulk collect statement in triggers?

1 Answers   Polaris,


How to add Foreign key in a table after the creation of the table?

5 Answers   Satyam,


describe mysql connection using mysql binary. : Sql dba

0 Answers  


What are different methods to trace the pl/sql code?

0 Answers  


i have a word ***********hello********world******. I require a o/p **********hello world**********, Need to delete the middle stars.

3 Answers  


how to get help information from the server? : Sql dba

0 Answers  


Categories