Re: complex insert
Posted by: Bill Karwin
Date: July 11, 2006 10:35AM

Sorry I haven't replied sooner. I am not sure what response you want. I don't know the table structure of your schema, or the format of the data file, so I can't suggest a more specific solution.

One thing is certain: you do need to supply syntactically correct SQL statements at all times. SQL does not recognize the syntax of leaving a field empty in a list of values. That is, you must supply a value, or else NULL. Also, the number of values in the row constructor must be equal to the number of columns specified for the INSERT.

There's also a method to import a bulk amount of data using the LOAD DATA statement, but this also requires that there be a value on each row for every column, or else "\N" to signify NULL. A zero-length string value is interpreted as ''. For example you could load a datafile containing something like this:

value1,value2,,value4

Importing the line above would put the string '' into the third column of your table. This is not the same as NULL.

See http://dev.mysql.com/doc/refman/5.0/en/load-data.html for more information on LOAD DATA.

Options: ReplyQuote


Subject
Written By
Posted
July 07, 2006 02:13PM
July 07, 2006 02:35PM
July 07, 2006 06:52PM
Re: complex insert
July 11, 2006 10:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.