Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN;
- -- clear data-data yang terlibat, dont worry data akan di rollback di bawah
- DELETE FROM t_ou;
- DELETE FROM t_ou_type;
- DELETE FROM m_ou_structure;
- DELETE FROM m_partner;
- DELETE FROM m_partner_type;
- DELETE FROM m_partner_ou;
- DELETE FROM m_salesman_custom;
- DELETE FROM t_policy;
- DELETE FROM t_policy_ou;
- DELETE FROM t_user;
- DELETE FROM t_user_props;
- DELETE FROM t_user_role;
- DELETE FROM jl_upload_parameter;
- DELETE FROM ul_salesman;
- -- init data sesuai kebutuhan
- -- # init data ou type
- INSERT INTO t_ou_type(
- ou_type_id, tenant_id, ou_type_code, ou_type_name, create_datetime,
- create_user_id, update_datetime, update_user_id, version, active,
- active_datetime, non_active_datetime, flg_bu, flg_accounting,
- flg_legal, flg_sub_bu, flg_branch)
- VALUES (2000001, 11, 'OU-001', 'OU bu or branch', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' ', 'Y', 'N',
- 'N', 'N', 'Y'),
- (2000002, 11, 'OU-002', 'OU 002', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' ', 'Y', 'N',
- 'Y', 'Y', 'N');
- -- # init data ou
- INSERT INTO t_ou(
- ou_id, tenant_id, ou_code, ou_name, ou_parent_id, ou_type_id,
- create_datetime, create_user_id, update_datetime, update_user_id,
- version, active, active_datetime, non_active_datetime)
- VALUES (1000001, 11, 'OU-01', 'OU 01', -99, 2000001,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' '),
- (1000002, 11, 'OU-02', 'OU 02', -99, 2000001,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' '),
- (1000003, 11, 'OU-03', 'OU 03', -99, 2000001,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' '),
- (1000004, 11, 'OU-04', 'OU 04', -99, 2000001,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' '),
- (1000005, 11, 'OU-05', 'OU 05', -99, 2000002,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' ');
- -- # init data partner
- INSERT INTO m_partner(
- partner_id, tenant_id, partner_code, partner_name, ctgr_partner_id,
- partner_ext_name, npwp_id, holding_id, flg_holding, rank, create_datetime,
- create_user_id, update_datetime, update_user_id, version, active,
- active_datetime, non_active_datetime, line_of_business, price_level,
- industry_type, npwp_status)
- VALUES
- -- SALESMAN-001
- (10001, 11, 'SALESMAN-001', 'SALESMAN 001', -99,
- '', -99, -99, 'N', 'G', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' ', ' ', ' ',
- ' ', ' '),
- -- SALESMAN-002
- (10002, 11, 'SALESMAN-002', 'SALESMAN 002', -99,
- '', -99, -99, 'N', 'G', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' ', ' ', ' ',
- ' ', ' '),
- -- CUSTOMER-002
- (10003, 11, 'CUSTOMER-001', 'CUSTOMER 001', 1000001,
- '', -99, -99, 'N', 'G', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' ', ' ', ' ',
- ' ', ' ');
- -- # init data partner type
- INSERT INTO m_partner_type(
- tenant_id, partner_id, group_partner, type_partner_id,
- due_date, curr_code, amount_limit, flg_commision, create_datetime,
- create_user_id, update_datetime, update_user_id, version, active,
- active_datetime, non_active_datetime)
- VALUES (11, 10001, 'E', 1000004, --> type partner SLS
- -99, 'IDR', -99::numeric, 'N', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' '),
- (11, 10002, 'E', 1000004, --> type partner SLS
- -99, 'IDR', -99::numeric, 'N', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' '),
- (11, 10003, 'C', 1000001, --> type partner CUST
- -99, 'IDR', -99::numeric, 'N', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' ');
- -- # init data partner ou
- INSERT INTO m_partner_ou(
- partner_id, ou_id, version, create_datetime, create_user_id,
- update_datetime, update_user_id)
- VALUES (10001, 1000001, 0, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1),
- (10002, 1000002, 0, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1),
- (10003, 1000003, 0, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1);
- -- # init data policy
- INSERT INTO t_policy(
- policy_id, tenant_id, policy_code, policy_name, create_datetime,
- create_user_id, update_datetime, update_user_id, version, active,
- active_datetime, non_active_datetime)
- VALUES (201, 11, 'POLICY-201', 'POLICY 201', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' '),
- (202, 11, 'POLICY-202', 'POLICY 202', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' '),
- (203, 11, 'POLICY-203', 'POLICY 203', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y',
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), ' ');
- -- # init data policy ou
- INSERT INTO t_policy_ou(
- policy_ou_id, policy_id, ou_id, create_datetime, create_user_id,
- update_datetime, update_user_id, version, active, active_datetime,
- non_active_datetime)
- VALUES (301, 201, 1000001, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- ' '),
- (302, 202, 1000002, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- ' '),
- (303, 201, 1000002, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- ' '),
- (304, 203, 1000003, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- ' ');
- -- # init data user
- WITH insert_data_user AS (
- INSERT INTO t_user(
- user_id, tenant_id, username, email, fullname, password, phone,
- role_default_id, private_key, create_datetime, create_user_id,
- update_datetime, update_user_id, version, active, active_datetime,
- non_active_datetime, ou_default_id, policy_default_id)
- VALUES (101, 11, 'SALESMAN-001', '', 'SALESMAN 001', 'SALESMAN-001'||'_'||to_char(current_timestamp, 'YYYYMMDDHH24MISS'), '',
- 15000075, md5('SALESMAN-001'||'_'||to_char(current_timestamp, 'YYYYMMDDHH24MISS')), to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- ' ', 1000001, 201),
- (102, 11, 'SALESMAN-002', '', 'SALESMAN 002', 'SALESMAN-002'||'_'||to_char(current_timestamp, 'YYYYMMDDHH24MISS'), '',
- 15000075, md5('SALESMAN-002'||'_'||to_char(current_timestamp, 'YYYYMMDDHH24MISS')), to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- ' ', 1000002, 202)
- RETURNING *
- ), insert_data_user_prop AS (
- -- # init data user props
- INSERT INTO t_user_props(
- prop_key, user_id, prop_val, create_datetime, create_user_id,
- update_datetime, update_user_id, version)
- SELECT 'count.login', A.user_id, 0::character varying, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0
- FROM insert_data_user A
- UNION ALL
- SELECT 'last.login', A.user_id, ' ', to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 1, 0
- FROM insert_data_user A
- )
- -- # init data user role
- INSERT INTO t_user_role(
- user_id, role_id, policy_id, create_datetime, create_user_id,
- update_datetime, update_user_id, version, active, active_datetime,
- non_active_datetime)
- SELECT A.user_id, A.role_default_id, A.policy_default_id, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, 0, 'Y', to_char(current_timestamp, 'YYYYMMDDHH24MISS'),
- ' '
- FROM insert_data_user A;
- -- # init data upload parameter
- INSERT INTO jl_upload_parameter(
- upload_header_id, key, value, create_user_id,
- create_datetime, update_user_id, update_datetime, version)
- VALUES (111, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (112, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (113, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (114, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (115, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (116, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (117, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (118, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (119, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (120, 'tenantId', '11', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (111, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (112, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (113, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (114, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (115, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (116, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (117, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (118, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (119, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (120, 'userId', '-1', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (111, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (112, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (113, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (114, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (115, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (116, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (117, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (118, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (119, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0),
- (120, 'datetime', '20180913000000', -1,
- to_char(current_timestamp, 'YYYYMMDDHH24MISS'), -1, to_char(current_timestamp, 'YYYYMMDDHH24MISS'), 0);
- INSERT INTO ul_salesman(
- upload_header_id, status, message, update_status,
- kode_ou, kode_salesman, first_name, last_name, active)
- VALUES (111, '', '', '',
- 'OU-01', 'SALESMAN-001', 'SLS', '01', 'Y'),
- (111, '', '', '',
- 'OU-02', 'SALESMAN-002', 'SLS', '02', 'N'),
- (111, '', '', '',
- 'OU-03', 'SALESMAN-003', 'SLS', '03', 'Y'),
- (111, '', '', '',
- 'OU-04', 'SALESMAN-004', 'SLS', '04', 'Y');
- /** RUN TEST SUCCESS **/
- SELECT ul_upload_salesman(111);SELECT * FROM ul_salesman WHERE upload_header_id = 111;
- WITH data_result_test_success AS (
- /** Pastikan perubahan nama pada salesman **/
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'Perubahan nama Salesman SALESMAN-001' AS case
- FROM m_partner
- WHERE partner_code = 'SALESMAN-001'
- AND partner_name = 'SLS 01'
- UNION ALL
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'Perubahan nama Salesman SALESMAN-002' AS case
- FROM m_partner
- WHERE partner_code = 'SALESMAN-002'
- AND partner_name = 'SLS 02'
- UNION ALL
- /** Pastikan data user full name berubah **/
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'Perubahan nama Username SALESMAN-001' AS case
- FROM t_user
- WHERE username = 'SALESMAN-001'
- AND fullname = 'SLS 01'
- UNION ALL
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'Perubahan nama Username SALESMAN-002' AS case
- FROM t_user
- WHERE username = 'SALESMAN-002'
- AND fullname = 'SLS 02'
- UNION ALL
- /** Pastikan terbentuk salesman baru **/
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data Salesman SALESMAN-003' AS case
- FROM m_partner
- WHERE partner_code = 'SALESMAN-003'
- AND partner_name = 'SLS 03'
- UNION ALL
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data Salesman SALESMAN-004' AS case
- FROM m_partner
- WHERE partner_code = 'SALESMAN-004'
- AND partner_name = 'SLS 04'
- UNION ALL
- /** Pastikan data user terbentuk **/
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END message, 'New data User SALESMAN-003' AS case
- FROM t_user
- WHERE username = 'SALESMAN-003'
- AND fullname = 'SLS 03'
- UNION ALL
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END message, 'New data User SALESMAN-004' AS case
- FROM t_user
- WHERE username = 'SALESMAN-004'
- AND fullname = 'SLS 04'
- UNION ALL
- /**
- * Pastikan data user props terbentuk untuk SALESMAN-003 & SALESMAN-004
- */
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data User Props count.login SALESMAN-003' AS case
- FROM t_user_props
- WHERE prop_key = 'count.login'
- AND f_get_username(user_id) = 'SALESMAN-003'
- UNION ALL
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data User Props last.login SALESMAN-003' AS case
- FROM t_user_props
- WHERE prop_key = 'last.login'
- AND f_get_username(user_id) = 'SALESMAN-003'
- UNION ALL
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data User Props count.login SALESMAN-004' AS case
- FROM t_user_props
- WHERE prop_key = 'count.login'
- AND f_get_username(user_id) = 'SALESMAN-004'
- UNION ALL
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data User Props last.login SALESMAN-004' AS case
- FROM t_user_props
- WHERE prop_key = 'last.login'
- AND f_get_username(user_id) = 'SALESMAN-004'
- UNION ALL
- /**
- * Pastikan data user role terbentuk untuk SALESMAN-003 & SALESMAN-004
- */
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data User Role SALESMAN-003' AS case
- FROM t_user_role
- WHERE f_get_username(user_id) = 'SALESMAN-003'
- AND role_id = 15000075
- UNION ALL
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data User Role SALESMAN-004' AS case
- FROM t_user_role
- WHERE f_get_username(user_id) = 'SALESMAN-004'
- AND role_id = 15000075
- UNION ALL
- /**
- * Pastikan terbentuk data t_policy untuk OU-04
- * yang di pakai SALESMAN-004
- * karena belum ada data policy ou dengan ou = OU-04 **/
- SELECT CASE WHEN COUNT(1) = 0 THEN 'FAIL' ELSE 'SUCCESS' END AS message, 'New data Policy dari data OU-04 yang di pakai SALESMAN-004' AS case
- FROM t_policy
- WHERE policy_code = 'OU-04_20180913000000'
- AND policy_name = 'OU 04'
- )
- /** SHOW RESULT TEST SUCCESS **/
- SELECT * FROM data_result_test_success;
- ROLLBACK;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement