Thursday, July 14, 2011

How to get first day and last date of week, month, quarter, year in Oracle

--First day of current week(sunday)
select TRUNC(SYSDATE, 'Day') from dual;
--First day of next week(sunday)
select TRUNC(SYSDATE+7 , 'Day') from dual;
--First day of previous week(sunday)
select TRUNC(SYSDATE-7 , 'Day') from dual;
--First day of current month
select TRUNC(SYSDATE , 'Month') from dual;
--First day of previous month
select TRUNC(TRUNC(SYSDATE , 'Month')-1 , 'Month') from dual;
--First day of next month
select TRUNC(LAST_DAY(SYSDATE)+1 , 'Month') from dual;
--First day of current year
select TRUNC(SYSDATE , 'Year') from dual;
--First day of previous year
select TRUNC(TRUNC(SYSDATE , 'Year')-1 , 'Year') from dual;
--First day of next year
select ADD_MONTHS(TRUNC(SYSDATE , 'Year'),12) from dual;
-- First Day of Current quater
select TRUNC(SYSDATE , 'Q') from dual;
--  First Day of Previous Quarter
select ADD_MONTHS(TRUNC(SYSDATE , 'Q'),-3) from dual;
--  First Day of Next Quarter
select ADD_MONTHS(TRUNC(SYSDATE , 'Q'),3) from dual;

--Last day of current week(sunday)
select TRUNC(SYSDATE, 'Day')+6 from dual;
--Last day of next week(sunday)
select TRUNC(SYSDATE+7 , 'Day')+6 from dual;
--Last day of previous week(sunday)
select TRUNC(SYSDATE-7 , 'Day')+6 from dual;
--Last day of current month
select LAST_DAY(TRUNC(SYSDATE , 'Month')) from dual;
--Last day of previous month
select LAST_DAY(TRUNC(TRUNC(SYSDATE , 'Month')-1 , 'Month')) from dual;
--Last day of next month
select LAST_DAY(TRUNC(LAST_DAY(SYSDATE)+1 , 'Month')) from dual;
--Last day of current year
select LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE , 'Year'),11)) from dual;
--Last day of previous year
select LAST_DAY(ADD_MONTHS(TRUNC(TRUNC(SYSDATE , 'Year')-1 , 'Year'),11)) from dual;
--Last day of next year
select LAST_DAY(ADD_MONTHS(TRUNC(TRUNC(SYSDATE , 'Year')-1 , 'Year'),-13)) from dual;
-- Last Day of Current quater
select LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE , 'Q'),2)) from dual;
--  Last Day of Previous Quarter
select TRUNC(SYSDATE , 'Q')-1 from dual;
--  Last Day of Next Quarter
select LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE , 'Q'),5)) from dual;

Wednesday, July 13, 2011

How to see Last Refreshed Date Time of Materialized View


select * from USER_MVIEWS
 where mview_name = 'MYVIEW';

Wednesday, July 06, 2011

Personalize page view panels Search page in e-Business Suite

Go to System Administrator --> Profile --> System

To Enable Personalize region links for each region in a page
FND: Personalization Region Link Enabled -- Set to Yes

To Enable About this page
FND: Diagnostics -- Set to Yes

To Enable Global Personalize Page Link
Personalize Self-Service Defn --> Yes

Go to Sales Dashboard --> Personalize Page.
Select Content and go to the corresponding Search and click pen(Personalize properties)

Go down to the field and you will see an icon in seeded user views corresponding to the table.

In here create user views and map it to the responsibilities

Thursday, March 31, 2011

How to display carriage return in oa framework web page table.

   I am having a column in a table which has carriage return chr(13) in the value. oracle will take care of this in forms by giving a line break. But OA Framework does not allow it.

I searched for many places in the net and couldnt find a solution. so i tried and found an alternative. Go to that column in the Region of type table and make the item style as raw text. While getting the code from VO object, change the column in the query to Replace(column_name,chr(13),'<br>')
If you have used chr(10) you can also replace it with


So when showing in table, there will be a line break for each chr(13)

Wednesday, March 02, 2011

Error "You cannot change the owner of this service request because there is an active workflow in progress" in E-business Suite

   In Create SR Page, When a SR is created for a particular SR type. the task gets created after that usually[Tasks are defined in Task Template].
But currently it is taking 10 to 15 minutes to automatically create. During this time, if we try to update sr we get error “You cannot change the owner of this service request because there is an active workflow in progress”. 

Solution: Go to Setup Service Requests -> Request Types   
Select the service type you are facing problem and you would see that the workflow contains
"@Duplicate Check and Auto Task Create for Web/EMC created SR"

Clear the workflow field and save. Now the issue will not come