1

I am getting this error while inserting values in a table. I have more than 500 rows to insert. More than 100 rows have been inserted using same method but it gets an error in this line.

INSERT INTO CHICAGO_CRIME_DATA (ID, CASE_NUMBER, DT, BLOCK, IUCR, PRIMARY_TYPE, DESCRIPTION, LOCATION_DESCRIPTION, ARREST, DOMESTIC, BEAT, DISTRICT, WARD, COMMUNITY_AREA_NUMBER, FBICODE, X_COORDINATE, Y_COORDINATE, YEAR, LATITUDE, LONGITUDE, LOCATION) 
VALUES (7646435.0, 'HS451246', '8/7/2010', '023XX W ROSCOE ST', 460.0, 'BATTERY', 'SIMPLE', 'SIDEWALK', 'TRUE', 'FALSE', 1913.0, 19.0, 32.0, 5.0, 08B, 1160352.0, 1922529.0, 2010.0, 41.94312358, -87.68603108, '(41.943123577, -87.686031082)')
2
  • what's datatype of "location"? Commented Jun 9, 2021 at 16:46
  • 08B should be '08B'. Assuming FBICODE is a string column; if not then your data is bad. That is causing that error anyway. (Also '8/7/2010' appears to be going into a date column so you should really use to_date() or a date literal. not a string literal.) Commented Jun 9, 2021 at 16:50

2 Answers 2

1

I think the error is raised because of this value "08B" , for FBICODE column,

seems like it should be wrapped in singlqquote

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. But previous 100 rows were inserted without any error. I have used import table function from sql developer and trying to insert data from a csv file.
@MohammadLitonHossain because last 100 rows didn't have bad data , but this row has
Thanks everyone. There are some bad data in my data set.
1

Instead of 08B you need to use '08B'

Corrected Query:

INSERT INTO CHICAGO_CRIME_DATA (ID, CASE_NUMBER, DT, BLOCK, IUCR, PRIMARY_TYPE, DESCRIPTION, LOCATION_DESCRIPTION, ARREST, DOMESTIC, BEAT, DISTRICT, WARD, COMMUNITY_AREA_NUMBER, FBICODE, X_COORDINATE, Y_COORDINATE, YEAR, LATITUDE, LONGITUDE, LOCATION) 
VALUES (7646435.0, 'HS451246', '8/7/2010', '023XX W ROSCOE ST', 460.0, 'BATTERY', 'SIMPLE', 'SIDEWALK', 'TRUE', 'FALSE', 1913.0, 19.0, 32.0, 5.0, '08B', 1160352.0, 1922529.0, 2010.0, 41.94312358, -87.68603108, '(41.943123577, -87.686031082)')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.