SundancerKid
Programmer
Hi All,
I need to evaluate the following and I think my syntax is wrong.
Please help!!
Here is the original code from an Oracle View since I can not pass the Current User ID to Oracle to determine the user
Oracle Function
I need to evaluate the following and I think my syntax is wrong.
Please help!!
Code:
IF ({Q.SAMPLENO} = {Q.MASTERSAMPLENO} OR
ISNULL({Q.MASTERSAMPLENO})) OR
{Q.ISTIMEWEIGHTED} <> -1) AND
{Q.APPROVED} = -1 AND
***** This replaced the Oracle Function *****
(IF {@TechConsultant} = -1 AND
NOT ISNULL({Q.MONITORBY}) AND
UPPERCASE({Q.MONITORBY}) = UPPERCASE(CurrentCEUserName) AND
(ISNULL({Q.SAMPLESTATUSTYPE}) OR
{Q.SAMPLESTATUSTYPE}='I' OR
{Q.SAMPLESTATUSTYPE}='A' OR
{Q.SAMPLESTATUSTYPE}='Q') then
0
Else 1) = 1 then
0
Else
1
Here is the original code from an Oracle View since I can not pass the Current User ID to Oracle to determine the user
Code:
WHERE ((((IH.SampleNo = IH.MasterSampleNo) OR IH.MasterSampleNo IS NULL))
OR ((IHLT.IsTimeWeighted <> -1))) AND IH.Approved=-1 AND Med_SelectByTechnicianNew (IH.MonitorBy,(SELECT IHSB.SampleStatusType FROM IHSampleStatus IHSB WHERE IHSB.SampleStatusID= IH.SampleStatusID))=-1
Oracle Function
Code:
Med_SelectByTechnicianNew
(monitorby varchar2,v_type varchar2)
return number
is
technician number(1);
v_val number(1);
cursor cr is
select IHSB.TechnicianConsultant
from IHSampledBy IHSB
where upper(IHSB.MonitorBy)=upper(USER);
begin
v_val := -1;
open cr;
fetch cr into technician;
if not cr%NOTFOUND then
if technician is not null and technician=-1 then
if monitorby is not null and upper(monitorby)=upper(USER) then
if not (v_type is null or v_type='I' or v_type='A' or v_type='Q') then
v_val := 0;
end if;
else
v_val := 0;
end if;
end if;
end if;
close cr;
return v_val;
end Med_SelectByTechnicianNew;