------------------------------------------------------------------------------------------------------------
-- NB :
DECLARE @temp_table_nb TABLE ( 
														proposal_no VARCHAR(12),
														policy_no VARCHAR(12),
														proposal_status_code VARCHAR(20),
														proposal_status VARCHAR(30)
													)
DECLARE 
	@pi_reference_number VARCHAR(50) = 'N11361',
	@contoh_konfigurasi VARCHAR(50) = 'PROP; PROP1; PROP3;PROP4 ; PROP5'

INSERT INTO @temp_table_nb
        (proposal_no,
         policy_no,
         proposal_status_code,
         proposal_status)	
EXEC [db_link_project].[EDITS].[proc_get_new_business_information] @pi_proposal_no = @pi_reference_number
--SELECT @@ERROR
SELECT * FROM @temp_table_nb
--SELECT * FROM @temp_table_nb WHERE CHARINDEX(proposal_status_code, 'PROP1') <> 0

SELECT
  *
FROM
  @temp_table_nb AS tmp CROSS APPLY
  dbo.func_explode(@contoh_konfigurasi,';') AS list

SELECT ItemNumber, LTRIM(RTRIM(item)) FROM [db_edits].[dbo].[func_explode] ('PROP; PROP1; PROP3;PROP4 ; PROP5',';')

SELECT * FROM [db_edits].[dbo].[func_explode] ('PROP; PROP1; PROP3;PROP4 ; PROP5',';')

IF EXISTS(SELECT * FROM @temp_table_nb)
	SELECT 'ada'
ELSE
	SELECT 'none'
------------------------------------------------------------------------------------------------------------
-- PS :
DECLARE @temp_table_ps TABLE ( 
														registration_no VARCHAR(13),
														policy_no VARCHAR(12),
														task_type_code VARCHAR(20),
														task_type VARCHAR(30),
														task_status_code VARCHAR(10),
														task_status VARCHAR(30)
													)

DECLARE 
	@pi_reference_number VARCHAR(50) = '000001063887'
	
INSERT INTO @temp_table_ps
        (registration_no,
         policy_no,
         task_type_code,
         task_type,
         task_status_code,
         task_status)
EXEC [db_link_project].[EDITS].[proc_get_alteration_information] @pi_registration_no = @pi_reference_number

SELECT * FROM @temp_table_ps

------------------------------------------------------------------------------------------------------------
-- CL :
DECLARE @temp_table_cl TABLE ( 
														claim_no VARCHAR(16),
														policy_no VARCHAR(12),
														claim_status_code VARCHAR(20),
														claim_status VARCHAR(30)
													)
DECLARE 
	@pi_reference_number VARCHAR(50) = 'HLT2016001505'

INSERT INTO @temp_table_cl
        (claim_no,
         policy_no,
         claim_status_code,
         claim_status)
EXEC [db_link_project].[EDITS].[proc_get_claim_information] @pi_claim_no = @pi_reference_number
SELECT * FROM @temp_table_cl