Java 第八章个案陈述
我想在普适中使用case语句,因为它也缺乏对Coalesce的支持。但似乎普及8也缺乏对案例陈述的支持 所以我想看看我的问题是否有其他解决方案Java 第八章个案陈述,java,jdbc,switch-statement,case,pervasive,Java,Jdbc,Switch Statement,Case,Pervasive,我想在普适中使用case语句,因为它也缺乏对Coalesce的支持。但似乎普及8也缺乏对案例陈述的支持 所以我想看看我的问题是否有其他解决方案 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.comp
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
选择前100名
STOCKTR.Pheadr,
”“汤姆
,当“”时为Pheadpr.BLNO,则Pheadpr.BLNO其他STOCKTR.Pheadpr结束为BLNO
,Pheadr.custno
,Pheadpr.cust_name
,Pheadr.公司名称
,Pheadr.company_市
,Pheadr.invno
,Pheadr.curr_代码
,STOCKTR.RECID
,STOCKTR.ARTNO
,STOCKTR.DATE
,库存数量(件)
,STOCKTR.PRICE_SEK_PCS
,STOCKTR.ULAND
从STOCKTR内部连接PHEADR
关于PHEADPR.NO=STOCKTR.PHEADPR
其中STOCKTR.TRCODE='02'和STOCKTR.PHEADPR'0'
按库存订购日期说明
所以我的问题集中在select语句的第四行
case Pheadpr.BLNO when <> '' then Pheadpr.BLNO else STOCKTR.PHEADPR end as BLNO
当“”时为Pheadpr.BLNO,则Pheadpr.BLNO其他STOCKTR.Pheadpr结束为BLNO
我希望这个结果是1列输出。在普适8中是否有办法解决这个问题,以便我可以从查询中获得类似案例的行为
作为旁注,我正在使用JDBC驱动程序并从Java程序执行查询。您可以使用IF语句。语法是: IF(搜索条件、表达式、表达式) 因此,在您的情况下,您可能需要: 如果(Pheadpr.BLNO“”、Pheadpr.BLNO、STOCKTR.Pheadpr)作为BLNO
如果可能的话,您应该考虑升级到PSQL V11的当前版本,既支持CASE语句又支持合并语句,也支持PSQL的支持版本。p> 您可以使用IF语句。语法是:
IF(搜索条件、表达式、表达式) 因此,在您的情况下,您可能需要: 如果(Pheadpr.BLNO“”、Pheadpr.BLNO、STOCKTR.Pheadpr)作为BLNO如果可能的话,您应该考虑升级到PSQL V11的当前版本,既支持CASE语句又支持合并语句,也支持PSQL的支持版本。p>