字典翻译 问答 其它 oraclesql语句传变量nvl((selectsum(NETWEIGHT)fromST_WEIGHTETLjl,ST_FUELCOMMDATAabwherejl.DATANUM=ab.datanumandjl.siteid=ab.siteidandjl.orgid=ab.orgid
问题标题:
oraclesql语句传变量nvl((selectsum(NETWEIGHT)fromST_WEIGHTETLjl,ST_FUELCOMMDATAabwherejl.DATANUM=ab.datanumandjl.siteid=ab.siteidandjl.orgid=ab.orgid
问题描述:

oraclesql语句传变量

nvl((selectsum(NETWEIGHT)

fromST_WEIGHTETLjl,ST_FUELCOMMDATAab

wherejl.DATANUM=ab.datanum

andjl.site id=ab.siteid

andjl.org id=ab.orgid

andab.WEIGHTR_STATUS='已确认'

andto_char(ab.WEIGHTTIME,'yyyy-mm-dd')=

to_char(sysdate,'yyyy-mm-dd')

andab.COMPANYNUM=ss.COMPANYNUM

andab.YEARPLANTYPE=ss.YEARPLANTYPE),

0)as日进煤量

nvl((selectsum(NETWEIGHT)

fromST_WEIGHTETLjl,ST_FUELCOMMDATAab

wherejl.DATANUM=ab.datanum

andjl.site id=ab.siteid

andjl.org id=ab.orgid

andab.WEIGHTR_STATUS='已确认'

andto_char(ab.WEIGHTTIME,'yyyy-mm')=

to_char(sysdate,'yyyy-mm')

andab.COMPANYNUM=ss.COMPANYNUM

andab.YEARPLANTYPE=ss.YEARPLANTYPE),

0)as月进煤累计

如何把查询中设计到的系统时间的判断to_char(sysdate,'yyyy-mm-dd')换成一个时间类型的变量

急!

曹娟娟回答:
  使用游标,单纯的SQL没法实现.
曹卫回答:
  能说的详细点吗?
曹娟娟回答:
  还是要看你实现什么功能,这个用法不是万能的。DeclareCursorCur_XX(V_DateinDate)isselect...fromTable_Namewheretrunc(WEIGHTTIME)=V_Date;BeginForcxinCur_XX(trunc(Sysdate))Loop.....EndLoop;End;
点击显示
其它推荐
热门其它推荐
  • 其它