当前位置: 代码迷 >> PB >> Powerbuilder,select into的有关问题,下面看详细
  详细解决方案

Powerbuilder,select into的有关问题,下面看详细

热度:54   发布时间:2016-04-29 06:35:29.0
Powerbuilder,select into的问题,下面看详细
datetime dt_date
select discharge_date_time into :dt_date from A where A.iD='1002';

上面的sql查询出来是空值,为什么dt_date=1900-1-1
有什么办法控制它 如果是空值就提示么?

------解决方案--------------------
楼主想提示什么呀?
datetime dt_date 
日期类型的变量,没得值,就默认1900-01-01吧,总不能等于空字符串吧

想提示的话,提前先判断一下吧
select count(1) into :ll_count from A where A.iD='1002' and discharge_date_time  is null;


------解决方案--------------------
引用:
datetime dt_date
select discharge_date_time into :dt_date from A where A.iD='1002';

上面的sql查询出来是空值,为什么dt_date=1900-1-1
有什么办法控制它 如果是空值就提示么?


if sqlca.sqlcode = 0 then
    //成功
else
    //找不到值,或其它原因,比如网线断了。
    setnull(dt_date)
end if
  相关解决方案