0

Please advise! New to SQL...

QL Error: ORA-01861: literal does not match format string

  1. 00000 - "literal does not match format string"

*Cause: Literals in the input must be the same length as literals in the format string (with the exception of leading whitespace). If the "FX" modifier has been toggled on, the literal must match exactly, with no extra whitespace.

*Action: Correct the format string to match the literal.

INSERT INTO STUDENT (Marticulationno, studentname, homeaddress, dob, sex, studentcategory, nationality, smoker, specialneeds, comments, enrollmentstatus, courses) 
VALUES ('1', 'Lemeuel Im', '101 Main Street TX 77070', '19800101', 'M', 'graduate', 'hindu', '0', 'na', 'none', 'enrolled', 'economics');
davejal
  • 6,009
  • 10
  • 39
  • 82
Starbucks
  • 1,448
  • 3
  • 21
  • 49
  • this is not the same error as before. What is your question exactly? And please elaborate more, don't show only your errors. – davejal Nov 22 '15 at 04:00
  • Oh, that's nice. So... you asked a lot of questions and have yet to accept any answers. This site goes both ways. If you expect help, you should reward those who help you by accepting their answer. Read http://meta.stackexchange.com/q/5234/308249? and start giving back to the community. – davejal Nov 22 '15 at 04:06

2 Answers2

1

As the error already states. You don't have enough values you want to insert.

I think one of these smoker, specialneeds, comments doesn't have a value

Either remove it from your query or add a value for that field.

davejal
  • 6,009
  • 10
  • 39
  • 82
  • Thank you for the help. Solved. Then I ran into this next error, which I edited on my page, because I cannot post more than one every >90 minutes.. – Starbucks Nov 22 '15 at 04:00
  • you should accept the answer and then ask a new question. – davejal Nov 22 '15 at 04:01
1
Marticulationno -> '1'
studentname ->  'Lemeuel Im'
homeaddress ->  '101 Main Street TX 77070'
dob ->  '19800101'
sex ->  'M'
studentcategory ->  'graduate'
nationality ->  'hindu'
smoker ->  '0'
specialneeds ->  'na'
comments ->  'enrolled'
enrollmentstatus ->  'economics'
courses ->

This is what you currently have. You are missing 1 value.

  • Thank you for the help. Solved. Then I ran into this next error, which I edited on my page, because I cannot post more than one every >90 minutes.. – Starbucks Nov 22 '15 at 04:00
  • [This](http://stackoverflow.com/questions/13518506/oracle-literal-does-not-match-format-string-error) should help. Basically the date variable is expecting different format. Consider using `to_date('2010-01-01','YYYY-MM-DD')` –  Nov 22 '15 at 04:03