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
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 |
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 |
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 |
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 |
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 |
What are analytical functions in sql?
How many functions are there in sql?
What is substitution variable?
How can multiply values of a column? OR How can multiply value of a row of a column using a single query in SQL?
What are the topics in pl sql?
How do I create a sql script?
What are different types of sql commands?
What is procedure and function?
What is the location of pre_defined_functions.
Define overloaded procedure?
What is a sql statement?
Write the sql query using dual table for below output? 1 L R --- --- ---- 1 1 1 1 2 1 1 3 1 1 1 2 1 2 2 1 3 2 1 1 3 1 2 3 1 3 3 Write a query using only Dual table with out writing any pl/sql program.