Home > database >  Ora - 00936: lack of expression
Ora - 00936: lack of expression

Time:10-25

Try to query the second-to-last day from last month to the penultimate day of this month's data, the results make a mistake, how change the

CodePudding user response:

Don't look good post text, images,

CodePudding user response:

Select rownum, t. *
The from (select to_char (SC_GROSSTIME, 'yyyy - mm - dd hh24: mi: ss'),
SC_TRACETIME,
Sc_TruckNo,
Sc_Qty db,
Sc_NetQty,
Sc_Qty,
Sc_NetQty - sc_BatchQty JDWC,
Decode (sc_Qty,
0,
Null,
Round ((sc_NetQty - sc_Qty)/sc_Qty * 100, 3)) XDCL,
Null yh,
Null bz
The from sc_data. Sc_Weighting_tb
Where SC_SHIPTYPENO='ZA'

{the and SC_PRODUCTNAME between LAST_DAY (to_date ({# val_P_YEAR #} | | '-' | | {# val_P_MONTH #} | | '1' | | '18:00:00', '- dd yyyy - mm hh24: mi: ss') - 1) - 1
And LAST_DAY (to_date ({# val_P_YEAR #} | | '-' | | {# val_P_MONTH #} | | '1' | | '18:00:00', '- dd yyyy - mm hh24: mi: ss') - 1)}
{and SC_PRODUCTNAME='# val_wl #}) t
Union all
The select null,
'total'
Null,
Null,
The sum (db),
The sum (sc_NetQty),
The sum (sc_Qty),
The sum (JDWC),
Decode (sum (sc_Qty),
0,
Null,
Round (sum (JDWC)/sum (sc_Qty) * 100, 3)) XDCL, null, null
The from (select SC_GROSSTIME,
SC_TRACETIME,
Sc_TruckNo,
Sc_Qty db,
Sc_NetQty,
Sc_Qty,
Sc_NetQty - sc_Qty JDWC,
Decode (sc_Qty,
0,
Null,
Round ((sc_NetQty - sc_Qty)/sc_Qty * 100, 3)) XDCL,
Null yh,
Null bz
The from sc_data. Sc_Weighting_tb
Where SC_SHIPTYPENO='ZA'
{the and SC_PRODUCTNAME between LAST_DAY (to_date ({# val_P_YEAR #} | | '-' | | {# val_P_MONTH #} | | '1' | | '18:00:00', '- dd yyyy - mm hh24: mi: ss') - 1) - 1 and LAST_DAY (to_date ({# val_P_YEAR #} | | '-' | | {# val_P_MONTH #} | | '1' | | '18:00:00', '- dd yyyy - mm hh24: mi: ss') - 1)}
{the and SC_PRODUCTNAME='# val_wl #}) t

CodePudding user response:

This is to modify the statement
  • Related