The following lines contain the word 'select', 'insert', 'update' or 'delete':
* error if the operation is UPDATE and record DOES NOT
* EXIST.
* In case of UPDATE if record exists, then the procedure
* will return old record in the old entity parameters
* with a success status.
*********************************************************************/
PROCEDURE Check_Existence
( p_change_line_rec IN Eng_Eco_Pub.Change_Line_Rec_Type
, p_change_line_unexp_rec IN Eng_Eco_Pub.Change_Line_Unexposed_Rec_Type
, x_old_change_line_rec IN OUT NOCOPY Eng_Eco_Pub.Change_Line_Rec_Type
, x_old_change_line_unexp_rec IN OUT NOCOPY Eng_Eco_Pub.Change_Line_Unexposed_Rec_Type
, x_mesg_token_tbl OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
, x_return_status OUT NOCOPY VARCHAR2
)
IS
l_token_tbl Error_Handler.Token_Tbl_Type;
(ENG_Globals.G_OPR_UPDATE, ENG_Globals.G_OPR_DELETE )
THEN
Error_Handler.Add_Error_Token
( x_Mesg_token_tbl => l_Mesg_Token_Tbl
, p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
, p_message_name => 'ENG_CL_DOESNOT_EXIST'
, p_token_tbl => l_token_tbl
) ;
* Procedure : Check_Attribute (Validation) for CREATE and UPDATE
* Parameters IN : Change Line exposed column record
* Change Line unexposed column record
* Parameters OUT: Return Status
* Message Token Table
* Purpose : Attribute validation procedure will validate each
* attribute of change line in its entirety. If
* the validation of a column requires looking at some
* other columns value then the validation is done at
* the Entity level instead.
* All errors in the attribute validation are accumulated
* before the procedure returns with a Return_Status
* of 'E'.
*********************************************************************/
PROCEDURE Check_Attributes
( p_change_line_rec IN Eng_Eco_Pub.Change_Line_Rec_Type
, p_change_line_unexp_rec IN Eng_Eco_Pub.Change_Line_Unexposed_Rec_Type
, p_old_change_line_rec IN Eng_Eco_Pub.Change_Line_Rec_Type
, p_old_change_line_unexp_rec IN Eng_Eco_Pub.Change_Line_Unexposed_Rec_Type
, x_mesg_token_tbl OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
, x_return_status OUT NOCOPY VARCHAR2
)
IS
l_return_status VARCHAR2(1);
IF p_change_line_rec.transaction_type = ENG_Globals.G_OPR_UPDATE
THEN
IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
('Change Line Attr Validation: Missing Value. . . ' || l_return_status) ;
IF p_change_line_rec.transaction_type = 'UPDATE' and
( p_change_line_unexp_rec.status_code <> 1 AND p_change_line_unexp_rec.status_code <> 4 AND p_change_line_unexp_rec.status_code <> 11
AND p_change_line_unexp_rec.status_code <> 5)
THEN
l_token_tbl(1).token_name := 'STATUS_NAME';
* Procedure : Check_Entity_Delete
* Parameters IN : Change Line exposed column record
* Change Line unexposed column record
* Parameters OUT: Return Status
* Message Token Table
* Purpose : Check_Entity validate the entity for the correct
* business logic to delete the record.
**********************************************************************/
PROCEDURE Check_Entity_Delete
( p_change_line_rec IN Eng_Eco_Pub.Change_Line_Rec_Type
, p_change_line_unexp_rec IN Eng_Eco_Pub.Change_Line_Unexposed_Rec_Type
, x_mesg_token_tbl OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
, x_return_status OUT NOCOPY VARCHAR2
)
IS
l_return_status VARCHAR2(1);
IF p_change_line_rec.transaction_type = ENG_Globals.G_OPR_DELETE
THEN
IF Bom_Globals.Get_Debug = 'Y' THEN Error_Handler.Write_Debug
('Change Line Entity Validation on Delete . . . ' || l_return_status) ;
('Change Line Entity Validation on Delete completed with return_status: ' || l_return_status) ;
('Some unknown error in Entity Validation on Delete. . .' || SQLERRM );
END Check_Entity_Delete ;
SELECT bom_item_type
, pick_components_flag
, bom_enabled_flag
, eng_item_flag
FROM MTL_SYSTEM_ITEMS
WHERE organization_id = p_org_id
AND inventory_item_id = p_item_id
;
SELECT 'Duplicate Seq Num'
FROM DUAL
WHERE EXISTS (
SELECT NULL
FROM ENG_CHANGE_LINES
WHERE sequence_number = p_seq_num
AND change_line_id <> p_change_line_id
AND change_id = p_change_id
--AND change_notice = p_change_notice
--AND organization_id = p_org_id
) ;
OR ( p_change_line_rec.transaction_type = BOM_Globals.G_OPR_UPDATE
AND p_change_line_rec.sequence_number
<> p_old_change_line_rec.sequence_number)
THEN
FOR l_duplicate_rec IN l_duplicate_csr
( p_change_line_id => p_change_line_unexp_rec.change_line_id
--, p_change_notice => p_change_line_rec.eco_name
--, p_org_id => p_change_line_unexp_rec.organization_id
, p_change_id => p_change_line_unexp_rec.change_id
, p_seq_num => p_change_line_rec.sequence_number )
LOOP
l_token_tbl(2).token_name := 'SEQ_NUM';
SELECT bom_item_type
FROM MTL_SYSTEM_ITEMS
WHERE inventory_item_id = p_item_id
AND organization_id = p_organization_id;