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 / 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


Please Help Members By Posting Answers For Below Questions

How to place comments in pl/sql?

1151


Explain constraints in sql?

1043


What are variables in pl sql?

1161


What is serial sql?

972


Explain scalar functions in sql?

1063


How many types of indexes are there in sql?

983


How many clustered indexes can you have?

973


how is exception handling handled in mysql? : Sql dba

1075


What is set serveroutput on?

1131


what does myisamchk do? : Sql dba

1010


What is sql integrity?

1148


how to calculate the difference between two dates? : Sql dba

1059


What is trigger point?

993


Why do we go for stored procedures?

1053


How long will it take to learn pl sql?

934