Query:
(
@P0 decimal(?, ?),
@P1 decimal(?, ?),
@P2 decimal(?, ?)
)
SELECT
s0.id odf_pk,
(
CASE
WHEN s0.PK_ID = (
SELECT
ID
FROM
INV_INVESTMENTS INV
WHERE
ODF_OBJECT_CODE = ?
AND ID = s0.PK_ID
) THEN s0.PK_ID
ELSE NULL
END
) as prprojectid
FROM
rim_risks_and_issues s0 (NOLOCK)
WHERE
(
s0.id = @P0
and (
exists(
select
?
from
(
select
sec.user_id
from
cmn_sec_chk_user_r_v0 sec
where
? = ?
and sec.object_id = ?
and sec.permission_code = ?
) odf_view_all
where
odf_view_all.user_id = @P1
)
or s0.id in (
select
sec.object_instance_id
from
cmn_sec_chk_user_v0 sec
where
? = ?
and sec.object_id in (
select
id
from
CMN_SEC_OBJECTS
where
object_code = ?
and object_type_code = ?
and sec.permission_code = ?
UNION
select
id
from
CMN_SEC_OBJECTS
where
object_code = ?
and object_type_code = ?
and sec.permission_code = ?
UNION
select
sec_obj.id
from
cmn_sec_objects sec_obj,
odf_objects obj
where
sec_obj.object_code = concat(?, obj.code)
and obj.template_extension = ?
and sec_obj.component_code = ?
and sec_obj.object_type_code = ?
and sec.permission_code = ?
)
and sec.permission_code in (?, ?)
and sec.user_id = @P2
)
)
)
Unknown