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 get second highest salary in sql?

907


Write the command to remove all players named sachin from the players table.

1120


what is a database transaction? : Sql dba

1104


How does a trigger work?

986


Can we use rowid as primary key?

941


How do I turn a list into a table?

905


Why are cursors used?

1056


what is myisam? : Sql dba

999


Which join condition can be specified using on clause?

898


How to place comments in pl/sql?

1095


How can you view the errors encountered in a trigger?

915


What are the set operators in sql?

1027


Can we use view in stored procedure?

862


Which query operators in sql is used for pattern matching?

901


Can function return multiple values in sql?

984