UPDATE ステートメント
既存のレコードを変更するには、UPDATE ステートメントを使用します。
Update 構文
UPDATE 構文はカンマ区切りのカラムをインプットとして取り、SET 句のname-value ペアを新しいカラム値として取ります。
UPDATE <table_name> SET <select_statement> | {<column_reference> = <expression> [ , ... ]} WHERE { Id = <expression> } [ { AND | OR } ... ]
<expression> ::=
| @ <parameter>
| ?
| <literal>
Statement またはPreparedStatement クラスのexecuteUpdate メソッドを使って、データ操作コマンドを実行し影響を受けた行を取得できます。
String cmd = "UPDATE Customer SET Contact='John' WHERE Id = ?";
PreparedStatement pstmt = connection.prepareStatement(cmd);
pstmt.setString(1, "http://myserver:7048/DynamicsNAV71/OData/Customer('01234567')");
int count = pstmt.executeUpdate();
System.out.println(count + " rows were affected");
connection.close();