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

Is sql injection illegal?

1017


How can we connect an Android App to an Oracle database and use the PL/SQL procedural code?

1136


What is trigger types in sql?

989


how to decrement dates by 1 in mysql? : Sql dba

1016


What is rtm stands for?

1093


What is the use of <> sql?

977


what is an execution plan? When would you use it? How would you view the execution plan? : Sql dba

971


What is where clause in sql?

1037


What is the purpose of the partition table?

1047


Is nosql faster than sql?

1017


Why do we need cursors in pl sql?

1076


What is memory optimized table?

1040


What is sql query limit?

975


Why do you partition data?

1016


how can we know the count/number of elements of an array? : Sql dba

1060