2

i'm creating the table with following query

CREATE TABLE LSP_Schedule(
lab_Id VARCHAR2(20) NOT NULL,
test_code VARCHAR2(10) NOT NULL,
test_date DATE NOT NULL,
slot_time VARCHAR2(20) NOT NULL,
duration NUMBER(3) NOT NULL CHECK (duration IN (30,60,90,120)),
status VARCHAR2(20) CHECK (status IN ('booked','Free')),
PRIMARY KEY (lab_Id,test_code)

)

and to insert the date into this table is write the query as follows

INSERT INTO LSP_SCHEDULE VALUES('1000','1001','2010-07-12','10:00AM-10:30AM',30,'booked')

but it shows the error as

ORA-01861:literal does not match format string

can you give the correction for the above query to insert the data successfully. i'm using SqlDbx version 3.51.1

Vatev
  • 7,493
  • 1
  • 32
  • 39
Gouse Shaik
  • 340
  • 1
  • 2
  • 15

2 Answers2

2

Try the following.

INSERT INTO LSP_SCHEDULE VALUES
      ('1000','1001', TO_DATE('2010-07-12', 'yyyy-mm-dd'),'10:00AM-10:30AM',30,'booked');

I guess u have to convert it to date format.

Arun Palanisamy
  • 5,281
  • 6
  • 28
  • 53
0

Try replacing the string literal for date '2010-07-12' with TO_DATE('2010-07-12','YYYY-MM-DD')

Aman Aggarwal
  • 17,619
  • 9
  • 53
  • 81
  • This Query "INSERT INTO LSP_SCHEDULE VALUES('1000','1001',to_date('2010-07-12','yyyy-mm-dd'),'10:00AM-10:30AM',30,'booked')" giving date along with time as 12:00:00AM but i want only date not time – Gouse Shaik Jul 23 '15 at 04:24