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
What is the mutating table and constraining table?
Can you rollback after commit?
Is oracle and sql same?
Mention what is the plv (pl/vision) package offers?
What is the use of non clustered index?
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?
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.
How many types of triggers exist in pl/sql?
What is the difference between a procedure and a function?
Is sqlite good enough for production?
How would you convert date into julian date format?
Are null values same as that of zero or a blank space?
Is coalesce faster than isnull?
how tsql statements can be written and submitted to the database engine? : Transact sql
what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba