How do you display "13th of November, 17 days left for
month end" without hardcoding the date.
Answer Posted / prativa mishra
create or replace function return_date(r_date DATE) return VARCHAR2
is
a number;
b VARCHAR2(200);
begin
begin
select LAST_DAY(TO_DATE(r_date,'DD/MM/RRRR')) - to_date(r_date,'DD/MM/RRRR') into a FROM DUAL;
end;
begin
select to_CHAR(r_date,'DDTH')||' '||'OF'||TO_char(r_date,'MONTH')||' ,'||a||' days left for month end' into b from dual;
end;
return b;
end;
execute:- select return_date(sysdate) from dual;
20TH OFNOVEMBER ,10 days left for month end
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What are the two different parts of the pl/sql packages?
Which is faster view or stored procedure?
How can you maintain the integrity of your database on instances where deleting an element in a table result in the deletion of the element(s) within another table?
what is log shipping? : Sql dba
The in operator may be used if you know the exact value you want to return for at least one of the columns.
What is the difference between alter trigger and drop trigger statements?
Which sorts rows in sql?
Why do we use sql constraints?
What is the cause of mutating table error and how can we solve it?
What is sql exception?
Will truncate release space?
What is the difference between numeric and autonumber?
What are three advantages to using sql?
How can we debug in PL/SQL?
How do I start pl sql?