Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is nvl?

1018


What is Materialized View? In What Scenario we Use Materialized View?

9397


What is the use of partition by in sql?

929


What is audit logout in sql profiler?

977


what is the difference between a having clause and a where clause? : Sql dba

1006


Is sqlite good enough for production?

948


how does a local variable is defined using t-sql? : Transact sql

948


how to do backup entire database? : Transact sql

1068


What is case function?

988


What is procedure and function in sql?

928


What is index example?

950


How is indexing done in search engines?

928


What is the difference between delete and truncate statement in sql?

1009


How to run pl/sql statements in sql*plus?

1021


What are triggers in sql?

972