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

What is the main difference between a UNION statement and a UNION ALL statement? 1. A UNION statement eliminates duplicate rows; a UNION ALL statement includes duplicate rows. 2. A UNION statement can be used to combine any number of queries; a UNION ALL statement can be used to combine a maximum of two queries. 3. A UNION statement can only combine queries that have parallel fields in the SELECT list; a UNION ALL statement can combine queries with differing SELECT list structures. 4. A UNION statement cannot be used with aggregate functions; a UNION ALL statement can be used with aggregate functions. 5. There is no difference between the two statements; they are interchangeable.

2 Answers   Saman Bank, Sonata,


How do I add a database to sql?

0 Answers  


Initially question was asked to mention the types of indexes. Then asked about BITMAP INDEX and B-Tree Index

2 Answers   Polaris,


What are some predefined exceptions in pl/sql?

0 Answers  


What is the maximum database size for sql express?

0 Answers  






I am creating an index on Emp table Empno column,if u using this indexed column in ur SELECT stmt. where clause,then how do u know that yr index will be working or nor? Thanks Advance...

3 Answers  


define sql delete statement ? : Sql dba

0 Answers  


How do you drop a trigger?

0 Answers  


What is date functions?

0 Answers  


What is trigger in sql and its types?

0 Answers  


Is microsoft sql free?

0 Answers  


How do you go back in sql?

0 Answers  


Categories