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 can we repair a mysql table? : Sql dba

1043


What are the benefits of pl/sql packages?

1161


What is sqlerrm?

987


how would you get the current date in mysql? : Sql dba

1017


explain about mysql and its features. : Sql dba

1054


How to write pl sql program in mysql command prompt?

1165


What is an intersect?

1156


What is a primary key example?

1003


what is cursor and its type, what is ref cursor write a syntax to pass ref cursor into procedure out fucntion and call the procedure

2169


What does data normalization mean?

1028


how to see the create table statement of an existing table? : Sql dba

1060


Why do we need pl sql?

1037


What operating systems are supported by oracle sql developer?

1016


Write a sql query to find the names of employees that begin with ‘a’?

1058


Is sql between inclusive?

1199