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 |
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?
what is the command for user data type?
how to calculate the difference between two dates? : Sql dba
How do you optimize a stored procedure in sql?
write a pl/sql function if enter a value=0 then output value=1 and vise verse with out using if and case statements.
What are data types in pl sql?
Can We write bulk collect statement in triggers?
How to add Foreign key in a table after the creation of the table?
describe mysql connection using mysql binary. : Sql dba
What are different methods to trace the pl/sql code?
i have a word ***********hello********world******. I require a o/p **********hello world**********, Need to delete the middle stars.
how to get help information from the server? : Sql dba