USE [MinovaHR_BANK_MEGA_Development]
GO
/****** Object:  UserDefinedFunction [dbo].[GetOrgInOrgWide]    Script Date: 20/06/2025 15.38.18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[GetOrgInOrgWide]
	(@org_id varchar(8), 
	@ref_date varchar(8), 
	@landscape varchar(3))
RETURNS @result TABLE (
	org_id varchar(8), 
	org_name varchar(250), 
	org_level varchar(4),
	parent_org_id varchar(8),
	parent_org_name varchar(250),
	parent_org_level VARCHAR(4),
	org_id_00 VARCHAR(8), 
	org_name_00 VARCHAR(250), 
	org_id_01 VARCHAR(8), 
	org_name_01 VARCHAR(250), 
	org_id_02 VARCHAR(8), 
	org_name_02 VARCHAR(250), 
	org_id_03 VARCHAR(8), 
	org_name_03 VARCHAR(250), 
	org_id_04 VARCHAR(8), 
	org_name_04 VARCHAR(250), 
	org_id_05 VARCHAR(8), 
	org_name_05 VARCHAR(250), 
	org_id_06 VARCHAR(8), 
	org_name_06 VARCHAR(250), 
	org_id_07 VARCHAR(8), 
	org_name_07 VARCHAR(250), 
	org_id_08 VARCHAR(8), 
	org_name_08 VARCHAR(250))
/*
SELECT * FROM dbo.GetOrgInOrg('00009004','20110101','','100', 1, 1)
*/
BEGIN

	INSERT INTO @result
	SELECT * FROM dbo.GetOrgInOrgWideDetail(@org_id,@ref_date,@landscape,1,'','',
	'','',
	'','',
	'','',
	'','',
	'','',
	'','',
	'','',
	'','',
	'','')

	RETURN
END




