-1
SET ECHO ON
SET VERIFY ON

ACCEPT CNUMBER CHAR PROMPT 'CUSTOMER NUMBER == '
ACCEPT PNUMBER CHAR PROMPT 'PART NUMBER == '
ACCEPT OD date format 'YYYYMMDD' PROMPT 'ORDER DATE == '


DELETE FROM ORDERS WHERE CNUM = &CNUMBER AND PNUM = &PNUMBER AND ORDERDATE = to_date(&OD,'YYYYMMDD'); 

PROMPT Done.

--DELETE FROM ORDERS WHERE CNUM = 'C111' AND PNUM = 'M001' AND ORDERDATE = to_date(20130401,'YYYYMMDD'); 

OUTPUT:

SQL> DELETE FROM ORDERS
  2  WHERE CNUM = &CNUMBER AND PNUM = &PNUMBER AND ORDERDATE = to_date(&OD,'YYYYMMDD');
old   2: WHERE CNUM = &CNUMBER AND PNUM = &PNUMBER AND ORDERDATE = to_date(&OD,'YYYYMMDD')
new   2: WHERE CNUM = C111 AND PNUM = M001 AND ORDERDATE = to_date(20130404,'YYYYMMDD')
WHERE CNUM = C111 AND PNUM = M001 AND ORDERDATE = to_date(20130404,'YYYYMMDD')
                             *
ERROR at line 2:
ORA-00904: "M001": invalid identifier 

Whats wrong??

4

1 回答 1

1

CNUM = '&CNUMBER' 和 PNUM = '&PNUMBER'

不确定 &OD,你也需要引用吗?

于 2013-05-06T08:19:32.797 回答