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

Can we create non-clustured index on a clustered index ?

4 Answers   TCS,


What is assignment operator in pl sql?

0 Answers  


how to insert the records in particular position

1 Answers  


What is consistency?

0 Answers  


Which one is better subquery or joins?

0 Answers  






Does sql support programming?

0 Answers  


what is a foreign key ? : Sql dba

0 Answers  


Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10

0 Answers  


create a store procedure and created synonms for that store procedure after modify that store procedure will effect on synonms? If we delete the store procedure what happened to that synonms?

2 Answers   Polaris,


Is natural join and inner join same?

0 Answers  


What is Function based Index and which type of function we can use in Function base index. can we use aggregate,NVL function in Function based Index..

1 Answers   Metric Stream, Polaris,


What is sql*loader?

0 Answers  


Categories