Back to OIM Explorer

dbo.QER_FTITShopNewProductNode

Inline Table FunctionSQL_INLINE_TABLE_VALUED_FUNCTIONSandbox DB

Inline Table Function.

Source: sandbox-db sys.sql_modules

Source size: 1.537 characters

Interpretation

  • Database function. Usually supports views, validation, or calculated predicates; look at referenced-by entries for callers.

Relations

  • No extracted relations.

Typed Edges

  • No typed edges extracted for this source.

References

  • No direct source references extracted.

Referenced By

Complete Source

SQL42 lines
1CREATE FUNCTION dbo.QER_FTITShopNewProductNode(2  @UID_BOTarget varchar(38),3  @ObjectkeyOrdered varchar(138),4  @Orderstate varchar(16),5  @UID_OrgPR_Old varchar(38),6  @IsReusePossible BIT,7  @UID_PersonOrdered_Old varchar(38),8  @UID_PersonOrdered_New varchar(38)9) RETURNS TABLE10AS11RETURN(12SELECT13  TOP 1 sh.uid_org AS UID_OrgSH,14  bo.UID_Org AS UID_OrgBO,15  pr.UID_Org AS UID_OrgPR,16  bo.Ident_Org AS Ident_OrgBO,17  sh.Ident_Org AS Ident_OrgSH,18  pr.Ident_Org AS Ident_OrgPR,19  pr.UID_PWODecisionMethod20FROM QER_VPWOProductNodesSlim n21JOIN BaseTree pr22  ON n.UID_OrgPR = pr.UID_Org23JOIN BaseTree bo24  ON pr.UID_ParentOrg = bo.UID_Org25JOIN BaseTree sh26  ON bo.UID_ParentOrg = sh.UID_Org27LEFT28OUTER29JOIN PersonInBaseTree pio30  ON (pio.uid_person = @UID_PersonOrdered_New AND pio.uid_org = pr.uid_org AND pio.XOrigin > 0)31WHERE32  n.ObjectkeyOrdered = @ObjectkeyOrdered AND(pr.UID_Org <> @UID_OrgPR_Old OR @UID_PersonOrdered_Old <> @UID_PersonOrdered_New) AND((@UID_BOTarget33> ' ' AND bo.UID_Org = @UID_BOTarget) OR(isnull(@UID_BOTarget, '') = '' AND bo.UID_Org <> isnull(@UID_BOTarget,34''))) AND EXISTS(35SELECT TOP 1 136FROM QER_VPWOShopMember h37WHERE38  h.uid_orgBO = bo.UID_Org AND h.uid_personOrdered = @UID_PersonOrdered_New) AND((@OrderState IN('Assigned',39'OrderProlongate', 'OrderUnsubscribe') AND @IsReusePossible = 0 AND pio.UID_Org IS NULL) OR @OrderState IN('Aborted',40'Dismissed', 'Granted', 'New', 'OrderProduct', 'Unsubscribed', 'Waiting') OR @IsReusePossible = 1)41ORDER BY sh.Ident_Org,42bo.Ident_Org)
Open raw exported source
SQL ยท Raw11 lines
1create function dbo.QER_FTITShopNewProductNode (@UID_BOTarget varchar(38) , @ObjectkeyOrdered varchar(138) , @Orderstate varchar(16) , @UID_OrgPR_Old varchar2(38) , @IsReusePossible bit , @UID_PersonOrdered_Old varchar(38) , @UID_PersonOrdered_New varchar(38)  ) returns table as return ( select top 1 sh.uid_org3 as UID_OrgSH , bo.UID_Org as UID_OrgBO , pr.UID_Org as UID_OrgPR  , bo.Ident_Org as Ident_OrgBO , sh.Ident_Org as Ident_OrgSH , pr.Ident_Org as Ident_OrgPR4 , pr.UID_PWODecisionMethod from QER_VPWOProductNodesSlim n join BaseTree pr on n.UID_OrgPR = pr.UID_Org join BaseTree bo on pr.UID_ParentOrg = bo.UID_Org5 join BaseTree sh on bo.UID_ParentOrg = sh.UID_Org   left outer join PersonInBaseTree pio on (pio.uid_person = @UID_PersonOrdered_New and pio.uid_org =6 pr.uid_org and pio.XOrigin > 0) where n.ObjectkeyOrdered = @ObjectkeyOrdered and (pr.UID_Org <> @UID_OrgPR_Old or @UID_PersonOrdered_Old <> @UID_PersonOrdered_New7 )  and ( ( @UID_BOTarget > ' ' and bo.UID_Org = @UID_BOTarget ) or (isnull(@UID_BOTarget, '') = '' and bo.UID_Org <> isnull(@UID_BOTarget, '') ) )  and8 exists (select top 1 1 from QER_VPWOShopMember h where h.uid_orgBO = bo.UID_Org and h.uid_personOrdered = @UID_PersonOrdered_New )  and  ( ( @OrderState9 in ('Assigned', 'OrderProlongate', 'OrderUnsubscribe' ) and @IsReusePossible = 0 and pio.UID_Org is null )  or @OrderState in ('Aborted', 'Dismissed',10 'Granted', 'New', 'OrderProduct', 'Unsubscribed', 'Waiting') or @IsReusePossible = 1 ) order by sh.Ident_Org, bo.Ident_Org ) 11