USE [AJK]
GO

--DECLARE	@return_value int,
--		@po_message varchar(200)

--EXEC	@return_value = [dbo].[proc_approve_peserta]
--		@pi_id_peserta = NULL,
--		@pi_id_status_underwriting = NULL,
--		@pi_approve_by = NULL,
--		@pi_approve_date = NULL,
--		@pi_approve_dateYa = NULL,
--		@pi_approve_note = NULL,
--		@po_message = @po_message OUTPUT

--SELECT	@po_message as N'@po_message'

--SELECT	'Return Value' = @return_value

--GO
------------------
DECLARE
  @id_peserta VARCHAR(12)

DECLARE list_cursor CURSOR FOR  
SELECT
	id_peserta
FROM
	dbo.peserta
WHERE
  no_polis = '16004-01-000'
  AND id_peserta >= '2016.0073043'
  AND id_peserta <= '2016.0085889'

OPEN list_cursor  
FETCH NEXT FROM list_cursor INTO @id_peserta  

WHILE @@FETCH_STATUS = 0  
BEGIN  

  DECLARE	
    @po_message varchar(200),
    @tgl_approve DATETIME = dbo.func_fixed_date(GETDATE())

  EXEC	[dbo].[proc_approve_peserta]
		  @pi_id_peserta = @id_peserta,
		  @pi_id_status_underwriting = '01',
		  @pi_approve_by = 'dje',
		  @pi_approve_date = @tgl_approve,
		  @pi_approve_dateYa = 1,
		  @pi_approve_note = '',
		  @po_message = @po_message OUTPUT

  PRINT	@po_message


  FETCH NEXT FROM list_cursor INTO @id_peserta  
END  

CLOSE list_cursor  
DEALLOCATE list_cursor 