Select
V_YaoPSZMX.DanWMC customer_name,
'' customer_address,
'' customer_zone,
'' contact_man,
'' tel,
V_YaoPSZMX.BanLSJ item_saledate,
V_YaoPSZMX.YaoPMC item_name,
V_YaoPSZMX.GuiG item_spec,
YaoPXX.DanW item_unit,
V_YaoPSZMX.PiH item_batch,
V_YaoPSZMX.ShuL item_number,
'' item_price
From
V_YaoPSZMX,YaoPXX
Where V_YaoPSZMX.YaoPBH=YaoPXX.YaoPBH And V_YaoPSZMX.LeiB='出库' Or V_YaoPSZMX.LeiB='出退' And V_YaoPSZMX.CangKBH='0011'
And
V_YaoPSZMX.ShangZ=1
And V_YaoPSZMX.BanLSJ>=To_Char(@startdate,'YYYY-MM-DD,HH24:Mi:SS')
And V_YaoPSZMX.BanLSJ<=To_Char(@enddate,'YYYY-MM-DD,HH24:Mi:SS')
V_YaoPSZMX.DanWMC customer_name,
'' customer_address,
'' customer_zone,
'' contact_man,
'' tel,
V_YaoPSZMX.BanLSJ item_saledate,
V_YaoPSZMX.YaoPMC item_name,
V_YaoPSZMX.GuiG item_spec,
YaoPXX.DanW item_unit,
V_YaoPSZMX.PiH item_batch,
V_YaoPSZMX.ShuL item_number,
'' item_price
From
V_YaoPSZMX,YaoPXX
Where V_YaoPSZMX.YaoPBH=YaoPXX.YaoPBH And V_YaoPSZMX.LeiB='出库' Or V_YaoPSZMX.LeiB='出退' And V_YaoPSZMX.CangKBH='0011'
And
V_YaoPSZMX.ShangZ=1
And V_YaoPSZMX.BanLSJ>=To_Char(@startdate,'YYYY-MM-DD,HH24:Mi:SS')
And V_YaoPSZMX.BanLSJ<=To_Char(@enddate,'YYYY-MM-DD,HH24:Mi:SS')
Select V_YaoPSZMX.DanWMC customer_name,
'' customer_address,
'' customer_zone,
'' contact_man,
'' tel,
V_YaoPSZMX.BanLSJ item_saledate,
V_YaoPSZMX.YaoPMC item_name,
V_YaoPSZMX.GuiG item_spec,
YaoPXX.DanW item_unit,
V_YaoPSZMX.PiH item_batch,
V_YaoPSZMX.ShuL item_number,
'' item_price
From V_YaoPSZMX, YaoPXX
Where V_YaoPSZMX.YaoPBH = YaoPXX.YaoPBH
And V_YaoPSZMX.LeiB = '出库'
Or V_YaoPSZMX.LeiB = '出退'
And V_YaoPSZMX.CangKBH = '0011'
And V_YaoPSZMX.ShangZ = 1
And V_YaoPSZMX.BanLSJ >= To_Char(startdate, 'YYYY-MM-DD,HH24:Mi:SS')
And V_YaoPSZMX.BanLSJ <= To_Char(enddate, 'YYYY-MM-DD,HH24:Mi:SS')
startdate date;
enddate date;
begin
startdate := .. -- 赋值
enddate := ...
Select V_YaoPSZMX.DanWMC customer_name,
'' customer_address,
'' customer_zone,
'' contact_man,
'' tel,
V_YaoPSZMX.BanLSJ item_saledate,
V_YaoPSZMX.YaoPMC item_name,
V_YaoPSZMX.GuiG item_spec,
YaoPXX.DanW item_unit,
V_YaoPSZMX.PiH item_batch,
V_YaoPSZMX.ShuL item_number,
'' item_price
From V_YaoPSZMX, YaoPXX
Where V_YaoPSZMX.YaoPBH = YaoPXX.YaoPBH
And V_YaoPSZMX.LeiB = '出库'
Or V_YaoPSZMX.LeiB = '出退'
And V_YaoPSZMX.CangKBH = '0011'
And V_YaoPSZMX.ShangZ = 1
And V_YaoPSZMX.BanLSJ >= To_Char(startdate, 'YYYY-MM-DD,HH24:Mi:SS') -- 直接写变量名即可。
And V_YaoPSZMX.BanLSJ <= To_Char(enddate, 'YYYY-MM-DD,HH24:Mi:SS');
....
....
end;
And V_YaoPSZMX.BanLSJ >= To_Char(@startdate, 'YYYY-MM-DD,HH24:Mi:SS')
And V_YaoPSZMX.BanLSJ <= To_Char(@enddate, 'YYYY-MM-DD,HH24:Mi:SS');
你说如果BanLSJ为时间型是不是要把 To_char改成TO_Date?