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
How to place comments in pl/sql?
Explain constraints in sql?
What are variables in pl sql?
What is serial sql?
Explain scalar functions in sql?
How many types of indexes are there in sql?
How many clustered indexes can you have?
how is exception handling handled in mysql? : Sql dba
What is set serveroutput on?
what does myisamchk do? : Sql dba
What is sql integrity?
how to calculate the difference between two dates? : Sql dba
What is trigger point?
Why do we go for stored procedures?
How long will it take to learn pl sql?