The following lines contain the word 'select', 'insert', 'update' or 'delete':
REM | 29-NOV-2005 kyadamak Added API Update_PeriodNames_In_Calendar for Enh#4711274 |
REM +==================================================================================+
*/
G_PKG_NAME CONSTANT VARCHAR2(30):='BSC_CALENDAR_PVT';
INSERT INTO bsc_sys_calendars_b
( calendar_id
, edw_flag
, edw_calendar_id
, edw_calendar_type_id
, fiscal_year
, fiscal_change
, range_yr_mod
, current_year
, start_month
, start_day
, created_by
, creation_date
, last_updated_by
, last_update_date
, last_update_login
, short_name
)
VALUES
( p_Calendar_Record.Calendar_Id
, p_Calendar_Record.Edw_Flag
, p_Calendar_Record.Edw_Calendar_Id
, p_Calendar_Record.Edw_Calendar_Type_Id
, p_Calendar_Record.Fiscal_Year
, p_Calendar_Record.Fiscal_Change
, p_Calendar_Record.Range_Yr_Mod
, p_Calendar_Record.Current_Year
, p_Calendar_Record.Start_Month
, p_Calendar_Record.Start_Day
, NVL(p_Calendar_Record.Created_By,FND_GLOBAL.USER_ID)
, NVL(p_Calendar_Record.Creation_Date,SYSDATE)
, NVL(p_Calendar_Record.Last_Updated_By,FND_GLOBAL.USER_ID)
, NVL(p_Calendar_Record.Last_Update_Date,SYSDATE)
, NVL(p_Calendar_Record.Last_Update_Login,FND_GLOBAL.LOGIN_ID)
, p_Calendar_Record.Dim_Short_Name
);
INSERT INTO bsc_sys_calendars_tl
( calendar_id
, language
, source_lang
, name
, help
, created_by
, creation_date
, last_updated_by
, last_update_date
, last_update_login
)
SELECT
p_Calendar_Record.Calendar_Id
, L.LANGUAGE_CODE
, USERENV('LANG')
, p_Calendar_Record.name
, p_Calendar_Record.Help
, NVL(p_Calendar_Record.Created_By,FND_GLOBAL.USER_ID)
, NVL(p_Calendar_Record.Last_Update_Date,SYSDATE)
, NVL(p_Calendar_Record.Last_Updated_By,FND_GLOBAL.USER_ID)
, NVL(p_Calendar_Record.Last_Update_Date,SYSDATE)
, NVL(p_Calendar_Record.Last_Update_Login,FND_GLOBAL.LOGIN_ID)
FROM FND_LANGUAGES L
WHERE L.INSTALLED_FLAG IN ('I', 'B')
AND NOT EXISTS
(
SELECT NULL
FROM bsc_sys_calendars_tl T
WHERE T.calendar_id = p_Calendar_Record.Calendar_Id
AND T.LANGUAGE = L.LANGUAGE_CODE
);
PROCEDURE Update_Calendar
( p_Api_Version IN NUMBER
, p_Commit IN VARCHAR2
, p_Calendar_Record IN BSC_CALENDAR_PUB.Calendar_Type_Record
, x_Return_Status OUT NOCOPY VARCHAR2
, x_Msg_Count OUT NOCOPY NUMBER
, x_Msg_Data OUT NOCOPY VARCHAR2
)IS
l_System_Stage bsc_sys_init.property_value%TYPE;
SAVEPOINT UpdateCalendarSP;
UPDATE bsc_sys_calendars_b
SET fiscal_year = p_Calendar_Record.Fiscal_Year
, current_year = p_Calendar_Record.Current_Year
, start_month = p_Calendar_Record.Start_Month
, start_day = p_Calendar_Record.Start_Day
, last_updated_by = p_Calendar_Record.Last_Updated_By
, last_update_date = p_Calendar_Record.Last_Update_Date
, last_update_login = p_Calendar_Record.Last_Update_Login
WHERE calendar_id = p_Calendar_Record.Calendar_Id;
UPDATE bsc_sys_calendars_tl
SET name = p_Calendar_Record.Name
, help = p_Calendar_Record.Help
, last_updated_by = p_Calendar_Record.Last_Updated_By
, last_update_date = p_Calendar_Record.Last_Update_Date
, last_update_login = p_Calendar_Record.Last_Update_Login
, source_lang = USERENV('LANG')
WHERE calendar_id = p_Calendar_Record.Calendar_Id
AND USERENV('LANG') IN (LANGUAGE, SOURCE_LANG);
UPDATE bsc_kpi_periodicities
SET current_period = p_Calendar_Record.Fiscal_Year
WHERE periodicity_id IN
( SELECT periodicity_id
FROM bsc_sys_periodicities
WHERE calendar_id = p_Calendar_Record.Calendar_Id
AND periodicity_type = 1
);
ROLLBACK TO UpdateCalendarSP;
x_msg_data := x_msg_data||' -> BSC_CALENDAR_PVT.Update_Calendar ';
x_msg_data := SQLERRM||' at BSC_CALENDAR_PVT.Update_Calendar ';
ROLLBACK TO UpdateCalendarSP;
x_msg_data := x_msg_data||' -> BSC_CALENDAR_PVT.Update_Calendar ';
x_msg_data := SQLERRM||' at BSC_CALENDAR_PVT.Update_Calendar ';
END Update_Calendar;
PROCEDURE Delete_Calendar
( p_Api_Version IN NUMBER
, p_Commit IN VARCHAR2
, p_Calendar_Record IN BSC_CALENDAR_PUB.Calendar_Type_Record
, x_Return_Status OUT NOCOPY VARCHAR2
, x_Msg_Count OUT NOCOPY NUMBER
, x_Msg_Data OUT NOCOPY VARCHAR2
)IS
BEGIN
SAVEPOINT DeleteCalendarSP;
DELETE bsc_db_week_maps
WHERE calendar_id = p_Calendar_Record.Calendar_Id;
DELETE bsc_db_calendar
WHERE calendar_id = p_Calendar_Record.Calendar_Id;
DELETE bsc_sys_periods_tl
WHERE periodicity_id IN
(
SELECT periodicity_id
FROM bsc_sys_periodicities
WHERE calendar_id = p_Calendar_Record.Calendar_Id
);
DELETE bsc_sys_periods
WHERE periodicity_id IN
(
SELECT periodicity_id
FROM bsc_sys_periodicities
WHERE calendar_id = p_Calendar_Record.Calendar_Id
);
DELETE bsc_sys_periodicities_tl
WHERE periodicity_id IN
(
SELECT periodicity_id
FROM bsc_sys_periodicities
WHERE calendar_id = p_Calendar_Record.Calendar_Id
);
DELETE bsc_sys_periodicities
WHERE calendar_id = p_Calendar_Record.Calendar_Id;
DELETE bsc_sys_calendars_tl
WHERE calendar_id = p_Calendar_Record.Calendar_Id;
DELETE bsc_sys_calendars_b
WHERE calendar_id = p_Calendar_Record.Calendar_Id;
ROLLBACK TO DeleteCalendarSP;
x_msg_data := x_msg_data||' -> BSC_CALENDAR_PVT.Delete_Calendar ';
x_msg_data := SQLERRM||' at BSC_CALENDAR_PVT.Delete_Calendar ';
ROLLBACK TO DeleteCalendarSP;
x_msg_data := x_msg_data||' -> BSC_CALENDAR_PVT.Delete_Calendar ';
x_msg_data := SQLERRM||' at BSC_CALENDAR_PVT.Delete_Calendar ';
END Delete_Calendar;
PROCEDURE Update_Fiscal_Change
( p_Api_Version IN NUMBER
, p_Commit IN VARCHAR2
, p_Calendar_Id IN NUMBER
, x_Return_Status OUT NOCOPY VARCHAR2
, x_Msg_Count OUT NOCOPY NUMBER
, x_Msg_Data OUT NOCOPY VARCHAR2
)IS
BEGIN
SAVEPOINT DeleteCalendarSP;
UPDATE bsc_sys_calendars_b
SET fiscal_change = 1
WHERE calendar_id = p_Calendar_Id;
ROLLBACK TO DeleteCalendarSP;
x_msg_data := x_msg_data||' -> BSC_CALENDAR_PVT.Update_Fiscal_Change ';
x_msg_data := SQLERRM||' at BSC_CALENDAR_PVT.Update_Fiscal_Change ';
ROLLBACK TO DeleteCalendarSP;
x_msg_data := x_msg_data||' -> BSC_CALENDAR_PVT.Update_Fiscal_Change ';
x_msg_data := SQLERRM||' at BSC_CALENDAR_PVT.Update_Fiscal_Change ';
END Update_Fiscal_Change;
PROCEDURE Update_PeriodNames_In_Calendar
( p_Calendar_Id IN NUMBER
, x_Return_Status OUT NOCOPY VARCHAR2
, x_Msg_Count OUT NOCOPY NUMBER
, x_Msg_Data OUT NOCOPY VARCHAR2
) IS
CURSOR C_Period_Names IS
SELECT BSCPER.short_name
,BSCPER.name
,BSCDIM.dim_level_id
,BISDIM.level_id
FROM bsc_sys_periodicities_vl BSCPER,
bsc_sys_dim_levels_vl BSCDIM,
bis_levels_vl BISDIM
WHERE BSCPER.short_name = BSCDIM.short_name
AND BSCPER.short_name = BISDIM.short_name
AND BSCDIM.short_name = BISDIM.short_name
AND BSCPER.calendar_id = p_Calendar_Id;
UPDATE bsc_sys_dim_levels_tl
SET name = l_Dimobj_New_Name
,SOURCE_LANG = userenv('LANG')
WHERE dim_level_id = CD.dim_level_id
AND USERENV('LANG') IN (LANGUAGE, SOURCE_LANG);
UPDATE bis_levels_tl
SET name = l_Dimobj_New_Name
,SOURCE_LANG = userenv('LANG')
WHERE level_id = CD.level_id
AND USERENV('LANG') IN (LANGUAGE, SOURCE_LANG);
x_msg_data := x_msg_data||' -> BSC_CALENDAR_PVT.Update_PeriodNames_In_Calendar ';
x_msg_data := SQLERRM||' at BSC_CALENDAR_PVT.Update_PeriodNames_In_Calendar ';
x_msg_data := x_msg_data||' -> BSC_CALENDAR_PVT.Update_PeriodNames_In_Calendar ';
x_msg_data := SQLERRM||' at BSC_CALENDAR_PVT.Update_PeriodNames_In_Calendar ';
END Update_PeriodNames_In_Calendar;