The following lines contain the word 'select', 'insert', 'update' or 'delete':
* Updated By For *
* *
* *
*****************************************************************
*/
-- Global variables
G_PKG_NAME CONSTANT VARCHAR2(30):='GR_ITEM_PROPERTIES_PUB';
l_last_update_login NUMBER(15,0) := 0;
SELECT organization_id INTO l_organization_id
FROM mtl_organizations
WHERE organization_code = l_organization;
SELECT inventory_item_id into l_inventory_item_id
FROM mtl_system_items_b_kfv
WHERE concatenated_segments = l_item
AND organization_id = l_organization_id;
SELECT 1
FROM mtl_system_items_b
WHERE inventory_item_id = l_inventory_item_id
AND organization_id = l_organization_id
AND hazardous_material_flag = 'Y';
SELECT 1
FROM
GR_LABELS_B B
where B.LABEL_CODE = l_field_name_code;
SELECT lcb.form_block
FROM
GR_LABELS_B B , gr_label_classes_b lcb
where B.LABEL_CODE = l_field_name_code and
lcb.label_class_code = b.label_class_code
and lcb.form_block in ('SAFETY_PHRASES', 'RISK_PHRASES' );
SELECT safety_phrase_code
FROM gr_safety_phrases_vl
WHERE safety_phrase_code = l_phrase_code;
SELECT risk_phrase_code
FROM gr_risk_phrases_vl
WHERE risk_phrase_code = l_phrase_code;
SELECT safety_phrase_code
FROM gr_inv_item_safety_phrases
WHERE safety_phrase_code = l_phrase_code
and organization_id = l_organization_id
and inventory_item_id = l_inventory_item_id;
SELECT risk_phrase_code
FROM gr_inv_item_risk_phrases
WHERE risk_phrase_code = l_phrase_code
and organization_id = l_organization_id
and inventory_item_id = l_inventory_item_id;
SELECT lp.sequence_number
FROM gr_label_properties lp
WHERE lp.label_code = l_field_name_code
AND lp.property_id = l_property_id;
SELECT 1
FROM
GR_PROPERTIES_B B
where B.PROPERTY_ID = l_property_id;
SELECT property_type_indicator,
LENGTH,
PRECISION,
range_min,
range_max
FROM
GR_PROPERTIES_B B
where B.PROPERTY_ID = l_property_id;
select 1
from GR_PROPERTY_values_TL
WHERE property_id = l_property_id
and language = l_language_code
and value = l_alpha_value;
INSERT INTO GR_INV_ITEM_SAFETY_PHRASES
(organization_id,
inventory_item_id,
safety_phrase_code,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login)
VALUES
(l_organization_id,
l_inventory_item_id,
l_phrase_code,
fnd_global.user_id,
sysdate,
fnd_global.user_id,
sysdate,
l_last_update_login);
INSERT INTO GR_INV_ITEM_RISK_PHRASES
(organization_id,
inventory_item_id,
risk_phrase_code,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login)
VALUES
(l_organization_id,
l_inventory_item_id,
l_phrase_code,
fnd_global.user_id,
sysdate,
fnd_global.user_id,
sysdate,
l_last_update_login);
GR_INV_ITEM_PROPERTIES_PKG.Insert_Row (
p_commit => p_commit,
p_called_by_form => 'F',
p_organization_id => l_organization_id,
p_inventory_item_id => l_inventory_item_id,
p_sequence_number => l_sequence_number, -- populated by gr_item_safety.get_properties
p_property_id => l_property_id ,
p_label_code => l_field_name_code,
p_number_value => l_numeric_value,
p_alpha_value => l_alpha_value,
p_date_value => l_date_value,
p_created_by => FND_GLOBAL.USER_ID,
p_creation_date => SYSDATE,
p_last_updated_by => FND_GLOBAL.USER_ID,
p_last_update_date => SYSDATE,
p_last_update_login => l_last_update_login,
x_rowid => row_id,
x_return_status => return_status,
x_oracle_error => oracle_error,
x_msg_data => msg_data);
'GR_NO_RECORD_INSERTED');
update gr_inv_item_properties
set number_value = l_numeric_value ,
alpha_value = l_alpha_value,
date_value = l_date_value,
last_updated_by = fnd_global.user_id,
last_update_date = sysdate,
last_update_login = l_last_update_login
WHERE organization_id = l_organization_id and
inventory_item_id = l_inventory_item_id
and label_code = l_field_name_code
and property_id = l_property_id;
DELETE from GR_INV_ITEM_SAFETY_PHRASES
WHERE organization_id = l_organization_id and
inventory_item_id = l_inventory_item_id
and safety_phrase_code = l_phrase_code;
-- validate that the record exists, and delete the record from the GR_INV_ITEM_RISK_PHRASES table
-- An error message will be written to the log file if the record does not exist
OPEN c_get_item_risk_phrase;
DELETE from GR_INV_ITEM_RISK_PHRASES
WHERE organization_id = l_organization_id and
inventory_item_id = l_inventory_item_id
and risk_phrase_code = l_phrase_code;
GR_INV_ITEM_PROPERTIES_PKG.delete_Rows
(p_commit => p_commit,
p_called_by_form => 'F',
p_delete_option => 'B', -- 'B' Delete all rows using the item and label combination.
p_organization_id => l_organization_id,
p_inventory_item_id => l_inventory_item_id,
p_label_code => l_field_name_code,
x_return_status => return_status,
x_oracle_error => oracle_error,
x_msg_data => msg_data);
'GR_NO_RECORD_INSERTED');