Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE
- row_exists NUMBER;
- BEGIN
- row_exists := -1;
- SELECT count(code_w_prefix)
- INTO row_exists
- FROM hv_user.cmd_cpt_form_v
- WHERE code_w_prefix = :P15_CODE_W_PREFIX
- AND insurance_type = :P15_INSURANCE_TYPE;
- IF row_exists >= 1 THEN
- UPDATE hv_user.cmd_cpt_form
- SET cpt_code = :P15_CPT_CODE,
- cpt_type_update = :P15_CPT_TYPE
- WHERE code_w_prefix = :P15_CODE_W_PREFIX
- AND insurance_type = :P15_INSURANCE_TYPE;
- RETURN;
- ELSE
- INSERT INTO hv_user.cmd_cpt_form
- (code_w_prefix, cpt_code, cpt_type_update, insurance_type, labgen_test_code, labgen_test_name, source_clinic, test_type)
- SELECT
- code_w_prefix,
- :P15_CPT_CODE,
- row_exists,--:P15_CPT_TYPE,
- :P15_INSURANCE_TYPE,
- labgen_test_code,
- labgen_test_name,
- source_clinic,
- test_type
- FROM hv_user.cmd_cpt_form_v
- WHERE code_w_prefix = :P15_CODE_W_PREFIX
- AND insurance_type = 'DEFAULT';
- RETURN;
- END IF;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement