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

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the mutating table and constraining table?

652


Can you rollback after commit?

624


Is oracle and sql same?

667


Mention what is the plv (pl/vision) package offers?

734


What is the use of non clustered index?

611






Write a program that shows the usage of while loop to calculate the average of user entered numbers and entry of more numbers are stopped by entering number 0?

1837


First round ------------------- - Procedure - Packages - Views - Virtual tables - Can we use dcl with in function? - Joins and few scenarios - Triggers and its type - Pragma, type and its functionality - How to create db link in oracle - Materialized view - How to find duplicate values from table? - Cursor and its functionality - Write a script to display friday and its date from a entire year. - Exception Handling Second round ------------------------ Gave a scenario like. Need to write a function to perform. When user try to change a password. It must not be last five password and a given password can be combination of characters, symbols, upper and lower case.

1223


How many types of triggers exist in pl/sql?

647


What is the difference between a procedure and a function?

586


Is sqlite good enough for production?

654


How would you convert date into julian date format?

704


Are null values same as that of zero or a blank space?

643


Is coalesce faster than isnull?

610


how tsql statements can be written and submitted to the database engine? : Transact sql

616


what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba

734