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
Can a foreign key be null?
Differentiate between % rowtype and type record.
What are user defined functions?
What is function and procedure in pl sql?
What is the difference between cross join and natural join?
What is t sql used for?
What is numeric function sql?
Is there a 64 bit version of ssms?
How many types of privileges are available in sql?
Why do we create stored procedures & functions in pl/sql and how are they different?
Is sql workbench free?
What are the different types of constraints?
what is commit? : Sql dba
How to set up sql*plus output format in oracle?
How can the performance of a trigger be improved?