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');
输出:
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
怎么了?
答案 0 :(得分:1)
CNUM ='& CNUMBER'和PNUM ='& PNUMBER'
不确定& OD,您是否也需要引用它?