How do you display "13th of November, 17 days left for
month end" without hardcoding the date.
Answer Posted / bijaylaxmi
create or replace function cal_date(i_date DATE) return VARCHAR2
is
x number;
y VARCHAR2(200);
begin
begin
select LAST_DAY(TO_DATE(i_date,'DD/MM/yyyy')) - to_date(i_date,'DD/MM/yyyy') into x FROM DUAL;
end;
begin
select to_CHAR(i_date,'DDTH')||' '||'OF'||TO_char(i_date,'MONTH')||' ,'||x||' days left for month end' into y from dual;
end;
return y;
end;
>select cal_date('13-NOV-12') from dual;
o/p:-13th of November, 17 days left for
month end".
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Why do we use sql constraints? Which constraints we can use while creating database in sql?
Explain alias in sql?
What is query syntax?
What is normalization in a database?
What does trigger mean in slang?
What is a procedure in pl sql?
what is a relationship and what are they? : Sql dba
How does sql*loader handles newline characters in a record? : aql loader
What is the purpose of cursors in pl/sql?
How to return multiple rows from the stored procedure?
What is bitemporal narrowing?
how can we destroy the session, how can we unset the variable of a session? : Sql dba
How many databases can sql express handle?
What is the best sql course?
What is union and union all keyword in sql and what are their differences?