SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
create procedure [dbo].[p_policy_situation_documents_parameters]
	@policy_situation_id int

as
	set nocount on;

	select ppd.*
	from pol_policies_situations pps 
		inner join pol_policies pp on pps.pols_policy_id = pp.pol_policy_id
		inner join pr_products_documents ppd on			ppd.prdd_branch_id = pp.pol_branch_id
													and ppd.prdd_product_code = pp.pol_product_code
													and ppd.prdd_act_code = pps.pols_act_code
	where pps.pols_policy_situation_id = @policy_situation_id
	order by ppd.prdd_document_order asc

GO
