The following lines contain the word 'select', 'insert', 'update' or 'delete':
Procedure Update_DBI_Log
( x_return_status OUT NOCOPY VARCHAR2
) IS
l_header_id NUMBER;
l_last_update_date DATE;
l_last_update_date_old DATE;
l_header_last_update_date DATE;
select line_id, header_id, l_header_last_update_date, 'N'
from oe_order_lines_all
where header_id = p_header_id;
last_update_date T_DATE := T_DATE(),
rec_exists_flag T_V1 := T_V1()
);
oe_debug_pub.add( 'ENTERING UPDATE_DBI API' , 1 ) ;
l_header_last_update_date := oe_order_util.g_header_rec.last_update_date;
IF oe_order_util.g_header_scredit_tbl(I).last_update_date IS NULL THEN
l_header_last_update_date :=
oe_order_util.g_old_header_scredit_tbl(I).last_update_date;
l_header_last_update_date :=
oe_order_util.g_header_scredit_tbl(I).last_update_date;
oe_debug_pub.add( 'LAST UPDATE DATE OLD=' || l_header_last_update_date ) ;
l_header_last_update_date := oe_order_util.g_header_adj_tbl(I).last_update_date;
oe_debug_pub.add( 'LAST UPDATE DATE OLD=' || l_header_last_update_date ) ;
l_dbi_rec.last_update_date,
l_dbi_rec.rec_exists_flag;
l_dbi_rec.last_update_date.EXTEND(oe_order_util.g_line_tbl.COUNT);
IF oe_order_util.g_line_tbl(I).last_update_date IS NULL THEN
l_dbi_rec.last_update_date(j) :=
oe_order_util.g_old_line_tbl(I).last_update_date;
l_dbi_rec.last_update_date(j) :=
oe_order_util.g_line_tbl(I).last_update_date;
oe_debug_pub.add( 'LAST UPDATE DATE=' || l_dbi_rec.last_update_date(j) ) ;
l_dbi_rec.last_update_date.EXTEND;
IF oe_order_util.g_line_scredit_tbl(I).last_update_date IS NULL
THEN
l_dbi_rec.last_update_date(j) :=
oe_order_util.g_old_line_scredit_tbl(I).last_update_date;
l_dbi_rec.last_update_date(j) :=
oe_order_util.g_line_scredit_tbl(I).last_update_date;
oe_debug_pub.add( 'LAST UPDATE DATE=' || l_dbi_rec.last_update_date(J) ) ;
l_dbi_rec.last_update_date.EXTEND;
IF oe_order_util.g_line_adj_tbl(I).last_update_date IS NULL
THEN
l_dbi_rec.last_update_date(J) :=
oe_order_util.g_old_line_adj_tbl(I).last_update_date;
l_dbi_rec.last_update_date(J) :=
oe_order_util.g_line_adj_tbl(I).last_update_date;
oe_debug_pub.add( 'LAST UPDATE DATE=' || l_dbi_rec.last_update_date(J) ) ;
SELECT 'Y'
INTO l_dbi_rec.rec_exists_flag(i)
FROM ONT_DBI_CHANGE_LOG
--- WHERE header_id = l_header_id bug 7319732 ,7347663
WHERE header_id=l_dbi_rec.header_id(i) ---bug 7319732 ,7347663
AND line_id = l_dbi_rec.line_id(i)
AND set_of_books_id = l_set_of_books_id
AND currency_code = l_currency_code
FOR UPDATE;
l_dbi_create_rec.last_update_date.EXTEND;
l_dbi_create_rec.last_update_date(j) := l_dbi_rec.last_update_date(i);
oe_debug_pub.add('Inserting new records ' || l_dbi_create_rec.line_id.COUNT );
INSERT INTO ONT_DBI_CHANGE_LOG
(HEADER_ID
,LINE_ID
,SET_OF_BOOKS_ID
,CURRENCY_CODE
,LAST_UPDATE_DATE
)
VALUES
(l_dbi_create_rec.header_id(i)
,l_dbi_create_rec.line_id(i)
,l_set_of_books_id
,l_currency_code
,l_dbi_create_rec.last_update_date(i)
);
UPDATE ONT_DBI_CHANGE_LOG
SET LAST_UPDATE_DATE = SYSDATE
--WHERE HEADER_ID = l_header_id
WHERE HEADER_ID = l_dbi_rec.header_id(i) --bug 7319732,7347663
AND LINE_ID = l_dbi_rec.line_id(i)
AND SET_OF_BOOKS_ID = l_set_of_books_id
AND CURRENCY_CODE = l_currency_code
AND l_dbi_rec.rec_exists_flag(i) = 'Y';
oe_debug_pub.add( 'In Others of Update_DBI_Log' , 1 ) ;
,'Update_DBI_log');
END Update_DBI_Log;