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
How many sql statements are used?
What are the differences between implicit and explicit cursors?
What are packages in pl sql and also explain its advantages?
what are myisam tables? : Sql dba
How can I speed up sql query?
What is self-join and what is the requirement of self-join?
What is sql stand for?
Define sql delete statement.
What is the size of partition table?
Is sql easier than java?
how to convert dates to character strings? : Sql dba
What is the difference between left and left outer join?
How to add a column ‘salary’ to a table employee_details?
When sql appeared?
what is the use of set statement in tsql? : Transact sql