我在这里再次询问
我对Oracle感到困惑,似乎当我在函数无法使用的情况下使用null时,我的代码如下:
它在附近出错了
"CASE WHEN :idSalesman is not null then enabled = null and deleted=0 else enabled =1 and deleted =0"
条件
SELECT a.id_outlet as idOutlet , a.name , a.plant as plant, a.segment, a.street1 as alamat, a.nota_retur
FROM (SELECT id_outlet, name, plant, segment, street1, nota_retur FROM outlet WHERE plant = :idPlant
AND (id_outlet || ' ' || name || ' ' || street1) like :request
AND enabled = 1 AND deleted = 0 and rownum = :limits ) a
INNER JOIN wilayah_kerja b ON b.id_salesman = nvl(:idSalesman, b.id_salesman) AND b.id_outlet = a.id_outlet
AND b.enabled = 1 AND b.deleted = 0
GROUP BY a.id_outlet
UNION
SELECT
A.Id_Outlet AS Idoutlet,A.Name,A.Plant AS Plant,A.Segment,A.Street1 AS Alamat,A.Nota_Retur
FROM ( SELECT Id_Outlet,Name,Plant,Segment,Street1,Nota_Retur
FROM Outlet
WHERE Plant =:Idplant
AND (CASE WHEN :idSalesman is not null then enabled = null and deleted=0 else enabled =1 and deleted =0 )
AND rownum >=:limits
AND (Id_Outlet || ' ' || Name || ' ' || Street1) LIKE :Request
)a
LEFT JOIN wilayah_kerja b ON b.id_outlet = a.id_outlet
and rownum = :limits
AND b.enabled = 1
AND b.deleted = 0
WHERE B.Id_Outlet Is NULL Group By A.Id_Outlet Order By Name Limit 10;
我试图将联合更改为:
SELECT a.id_outlet as idOutlet , a.name , a.plant as plant, a.segment, a.street1 as alamat, a.nota_retur
FROM (SELECT id_outlet, name, plant, segment, street1, nota_retur FROM outlet WHERE plant = :idPlant
AND (id_outlet || ' ' || name || ' ' || street1 ) like :request
AND rownum = :limits
AND enabled = 1 AND deleted = 0 AND NVL(:idSalesman , enabled = null AND deleted = 0))a
LEFT JOIN wilayah_kerja b ON b.id_outlet = a.id_outlet AND b.enabled = 1 AND b.deleted = 0
WHERE B.Id_Outlet Is NULL Group By A.Id_Outlet Order By Name Limit 10
使用NVL2,但是它给我“ a”附近的错误
NVL(:idSalesman , enabled = null AND deleted = 0))a
答案 0 :(得分:0)
Oracle在SQL语句中不支持单独的布尔类型。一个问题(至少)是:
> $FreeSpace = '600'
> [int]$FreeSpace -lt 5550
>> True
解决方案只是将其表达为布尔逻辑:
Missing type map configuration or unsupported mapping.
还请注意,internal class MyTypeProfile: Profile
{
public MyTypeProfile()
{
var map = CreateMap<FromType, Data.Ef.Models.ToType>();
map.ForMember(d => d.Id, s => s.Ignore());
}
}
不是有效的比较(除非您永远不希望某些东西评估为真)。