The following lines contain the word 'select', 'insert', 'update' or 'delete':
INSERT INTO cst_revenue_recognition_lines (
REVENUE_OM_LINE_ID,
ACCT_PERIOD_NUM,
POTENTIALLY_UNMATCHED_FLAG,
REVENUE_RECOGNITION_PERCENT,
LAST_EVENT_DATE,
INVENTORY_ITEM_ID,
OPERATING_UNIT_ID,
LEDGER_ID,
-- WHO COLUMNS
LAST_UPDATE_DATE,
LAST_UPDATED_BY,
CREATION_DATE,
CREATED_BY,
LAST_UPDATE_LOGIN,
REQUEST_ID,
PROGRAM_APPLICATION_ID,
PROGRAM_ID,
PROGRAM_UPDATE_DATE
)
SELECT p_revenue_event_line_id,
gps.effective_period_num,
'U', -- when OM inserts, put a value of 'U'. This will get changed to 'Y' at the beginning of the concurrent request. New rows coming in won't interfere.
1,
trunc(p_event_date),
p_inventory_item_id,
p_ou_id,
l_ledger_id,
-- WHO COLUMNS
sysdate,
FND_GLOBAL.user_id,
sysdate,
FND_GLOBAL.user_id,
FND_GLOBAL.login_id,
FND_GLOBAL.conc_request_id,
FND_GLOBAL.PROG_APPL_ID,
FND_GLOBAL.CONC_PROGRAM_ID,
sysdate
FROM gl_period_statuses gps
WHERE gps.application_id = 101 -- used GL instead of OM or AR in case they are not using GPS
--BUG#7211401: Truncation of the event date for last date of the period
AND TRUNC(p_event_date) BETWEEN gps.start_date AND gps.end_date
AND gps.set_of_books_id = l_ledger_id;
SELECT count(*)
INTO l_closed_cst_periods
FROM org_acct_periods oap,
gl_period_statuses gps,
hr_organization_information hoi
WHERE oap.organization_id = hoi.organization_id
AND oap.period_name = gps.period_name
AND oap.open_flag = 'N'
AND gps.application_id = 222
AND gps.effective_period_num = p_effective_period_num
AND gps.set_of_books_id = p_set_of_books_id
AND hoi.org_information1 = to_char(p_set_of_books_id)
AND hoi.org_information_context = 'Accounting Information';