一个发票处理的问题 Second time in above shift

只要 INVOICE ,INVOICE_LINE,SHIFT_ON,INVOICE_PAYMENT

一处理就在日志里写了一个错误 Second time in above shift
 
 
insert_shift_payment()


ORACLE ERROR at Sun May 27 21:54:44 2007
User: storep
Program:   Function: insert_shift_payment()  Line: 0
Stat:
Error: ORA-00001: unique constraint (OPS$STOREP.SHIFT_PAYMENT_P) violated

处理
select * from shift_payment where till_no=11 and date_on=to_date(20070527,'yyyymmdd')

delete from shift_payment where till_no=11 and time_on=949

commit

select * from shift_on

又出错了

ORACLE ERROR at Sun May 27 21:58:55 2007
User: storep
Program:   Function: insert_shift_vat()  Line: 0
Stat:
Error: ORA-00001: unique constraint (OPS$STOREP.SHIFT_VAT_P) violated

处理
select * from shift_vat where shift_vat.till_no=11 and shift_vat.date_on=to_date(20070527,'yyyymmdd')

delete from shift_vat where till_no=11 and time_on=949 and date_on=to_date(20070527,'yyyymmdd')

commit;

处理完成了

SQL> select * from till where till_no =11
  2  /

TILL_NO TOT_NBR_INVOICE         TOT_SALES
------- --------------- -----------------
     11             135           5464.40

 

SQL> select * from shift where till_no=11 and date_on=to_date(20070527,'yyyymmdd')
  2  /

TILL_NO CASHIER_NO DATE_ON     TIME_ON TIME_OFF INVOICE_ON INVOICE_OFF NBR_LINES NBR_VOID_INVOICE NBR_VOID_LINES       FOOD_AMOUNT      NFOOD_AMOUNT        VAT_AMOUNT   FD_SOLD_DEPOSIT   NF_SOLD_DEPOSIT FD_RETURN_DEPOSIT NF_RETURN_DEPOSIT    TOT_FEE_AMOUNT       START_FLOAT NRUN_DATE
------- ---------- ----------- ------- -------- ---------- ----------- --------- ---------------- -------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- ----------------- -----------
     11        315 2007-05-27      949       -1     147721      147811       545                1              2           3602.34            303.98            531.80              0.00              0.00              0.00              0.00              0.00            500.00
     11        315 2007-05-27      743      947     147674      147719       178                0              3           1448.70              8.49            179.40              0.00              0.00              0.00              0.00              0.00            500.00
     11        315 2007-05-27      948      948     147719      147720        19                0              0             92.02              9.70             13.85              0.00              0.00              0.00              0.00              0.00            500.00


总结是.只要 INVOICE (proc_ind =0 ),INVOICE_LINE,SHIFT_ON,INVOICE_PAYMENT
其他 SHIFT,shift_vat,shift_payment 里面不能有数据 

你可能感兴趣的:(oracle,Date,function,delete,insert,payment)