I have a table PERSON
with more than 5 million rows, and I need to update the field NICKNAME
for each of them based on the field NAME
inside the same table.
ResultSet rs = statement.executeQuery("select NAME from PERSON");
while(rs.next())
{
rs.updateString( "NICKNAME", Nickname );
rs.updateRow();
}
But I got this error:
not implemented by SQLite JDBC driver
I am using sqlite-jdbc-3.8.11.2.jar downloaded at https://bitbucket.org/xerial/sqlite-jdbc/downloads .
I know that I can use the following SQL query:
statement.executeUpdate("update PERSONS set NICKNAME = Nickname where ID = Id");
But it will take forever, and I understand that the update ResultSet
will be faster. So, what parameters do I need to update in the fastest way? Any other driver available? Should I navigate from Java?
UPDATE
, . CASE
END
, SQL-, .
update PERSON
set NICKNAME= case ID
when 173567 then 'blabla'
when 173568 then 'bleble'
...
when 173569 then 'blublu'
end
where ID in (173567, 173568, 173569)