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
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 |
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 |
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 |
what does the t-sql command ident_incr does? : Transact sql
how to shutdown mysql server? : Sql dba
How do you determine the current isolation level? : Transact sql
what is cursor procedure
What is the advantage of index in sql?
hi sql gurus, here is my question 4 u. i wanna use triggers for sending reminder mail to all users who are registered to the site. if any one knws the code plz send me ans here : chayabs3@gmail.com thnx advance
Can we use threading in pl/sql?
What is the difference between alter trigger and drop trigger statements?
How to retrieve a second highest salary from a table? Note:Suppose salaries are in duplicate values eg: Name Sal Malli 60000 Pandi 60000 Rudra 45000 Ravi 45000
10 Answers Mind Tree, Polaris, Sonata,
How to rename a table?
what is called after appearing where clause
How delete all records from table in sql?