0

I want to insert current date into my record, First I executed this query successfully.

insert into Member values (1, 'Richa Sharma', 'Pune', TO_DATE('10-Dec-05', 'DD-MM-YY'), 'Lifetime', '25000', 5, 50);

Then while executing the following query I'm getting the above error code.

insert into Member values (2, 'Garima Sen', 'Pune', SYSDATE, 'Annual', 100, 3, NULL);

EDIT: This is the query I used to create table.

create table Member (Member_Id number(5), 
Member_Name varchar2(30), 
Member_Address varchar2(50), 
Acc_Open_Date date, 
Membership_Type varchar2(20), 
Fees_Paid number(6), 
Max_Books_Allowed number(2), 
Penalty_Amount number(7,2),
PRIMARY KEY(Member_Id),
CHECK (Membership_Type IN ('Lifetime',' Annual', 'Half Yearly',' Quarterly')));
Aman Singh
  • 47
  • 1
  • 7

1 Answers1

2

Your check constraint has a leading space in ' Annual' change to 'Annual'

Jair Hernandez
  • 494
  • 3
  • 7
  • omg, so silly of me, all this time I thought the error is coming because of SYSDATE. Thank you so much. – Aman Singh Jun 27 '17 at 04:03
  • You're welcome Luffy, things like this happens to everybody, glad to help. and BTW just noticed `Quarterly` has also a leading space, be sure to fix that. – Jair Hernandez Jun 27 '17 at 05:04