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.

Answers were Sorted based on User's Feedback



How do you display "13th of November, 17 days left for month end" without hardcoding the..

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

How do you display "13th of November, 17 days left for month end" without hardcoding the..

Answer / prativa mishra

select hire_date,
to_char(hire_date,'ddth')||' '||'of'||'
'||to_char(hire_date,'month')||','||(last_day(hire_date)-
hire_date)||'days left for month end' aa
from
employees
where TO_DATE(HIRE_DATE,'DD-MON-RRRR')=&HIRE_DATE

Is This Answer Correct ?    3 Yes 1 No

How do you display "13th of November, 17 days left for month end" without hardcoding the..

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

More SQL PLSQL Interview Questions

Show the cursor attributes of pl/sql.

0 Answers  


Is crud a cuss word?

0 Answers  


SELECT ROUND(TRUNC(MOD(1600,10),-1),2) FROM dual;

10 Answers  


How many sql databases can you have on one server?

0 Answers  


What is the file extension for sql database?

0 Answers  


What are the sql versions?

0 Answers  


what is the difference between char and varchar data types? : Sql dba

0 Answers  


Can you call pl/sql package functions from within a fast formula?

0 Answers  


What is the result, when NULL is compared with NULL?

22 Answers   TCS,


What is cursor explain with example?

0 Answers  


Explain what is a subquery ?

0 Answers  


Can we rollback delete command?

0 Answers  


Categories