开发者

Writing CASE statement Error ORA-00923

开发者 https://www.devze.com 2023-01-29 11:05 出处:网络
I have a database that I have populated using CREATE and INSERT INTO statements. I am now trying to write a CASE statemenet that will display \'customers\' whose payment_due_date has passed todays dat

I have a database that I have populated using CREATE and INSERT INTO statements. I am now trying to write a CASE statemenet that will display 'customers' whose payment_due_date has passed todays date. Below is the following code

CREATE STATEMENT 'Ord'(Order)

CREATE TABLE Ord(OrderID varchar2(9) PRIMARY KEY, 
CustomerID varchar(9) REFERENCES Customer(CustomerID), 
Expected_Delivery_Date date DEFAULT sysdate NOT NULL, 
Actual_Delivery_Date date DEFAULT sysdate NOT NULL, 
Payment_Due_Date date DEFAULT sysdate NOT NULL,
 Order_Date date DEFAULT sysdate NOT NULL, Price Varchar(10), 
Order_Placed varchar2(1) CONSTRAINT OrderPlaced 
CHECK(Order_Placed IN('Y','N')) NOT NULL, Order_Confirmed varchar2(1)
CONSTRAINT Order_Confirmed CHECK(Order_Confirmed IN('Y','N')) 
NOT NULL, Order_Completed varchar2(1) CONSTRAINT Order_Completed
CHECK(Order_Completed IN('Y','N')) NOT NULL) 

INSERT STATEMENT

 INSERT INTO Ord VALUES(401565981, 501623129, 
    '10-Dec-10', '11-Dec-10', '07-Dec-10', '03-Dec-10','£14.99', 'Y', 'Y', 'Y')

CASE STATEMENT

 SELECT OrderID, CustomerID, Payment_Due_Date CASE WHEN 
Payment_Due_Date = '08-Dec-10' THEN 'Send Final Demand Letter'
    ELSE 'Do not send letter' 
    END FROM Ord;

When I try to run the above case statement I recieve the following error

ORA-00923: FROM keyword not found where expected 00923. 00000 - "FROM keyword not found where expe开发者_如何学运维cted" *Cause:

*Action: Error at Line: 26 Column: 50

Is there any possible way around this?


I think you need a comma between Payment_Due_Date and CASE.

0

精彩评论

暂无评论...
验证码 换一张
取 消