我想在 Pervasive 中使用 case 语句,因为它也缺乏对 Coalesce 的支持。但似乎 Pervasive 8 也缺乏对 Case 语句的支持。
所以我想检查我的问题是否有替代解决方案。
SELECT top 100
STOCKTR.PHEADPR,
'' as tom
,case Pheadpr.BLNO when <> '' then Pheadpr.BLNO else STOCKTR.PHEADPR end as BLNO
,Pheadpr.custno
,Pheadpr.cust_name
,Pheadpr.company_name
,Pheadpr.company_city
,Pheadpr.invno
,Pheadpr.curr_code
,STOCKTR.RECID
,STOCKTR.ARTNO
,STOCKTR.DATE
,STOCKTR.QTY_PCS
,STOCKTR.PRICE_SEK_PCS
,STOCKTR.ULAND
FROM STOCKTR INNER JOIN PHEADPR
ON PHEADPR.NO = STOCKTR.PHEADPR
WHERE STOCKTR.TRCODE='02' AND STOCKTR.PHEADPR <> '0'
order by STOCKTR.DATE desc
所以我的问题集中在我的选择语句中的第四行,上面写着
case Pheadpr.BLNO when <> '' then Pheadpr.BLNO else STOCKTR.PHEADPR end as BLNO
我希望这会产生 1 列输出。在普遍的 8 中有没有办法解决这个问题,以便我可以从我的查询中获得类似案例的行为?
作为旁注,我正在使用 JDBC 驱动程序并从 Java 程序中进行查询。