English 中文(简体)
甲骨质更新,约24 000 变化
原标题:Oracle update, make ~24000 changes

我想在Oracle做一个问询或某种功能,可以更新24 000个牢房。 例如,1个更新的问询就是这样:

update numbers
set status = 1 and some_id = 123123
where number_id = 1231;

在每一次询问中,“某些”和“数字”不同。

Problem is doing this one by one is taking too much time, I need quicker solution.

问题回答

将不同价值观纳入一个表格,然后在您的问询中使用:

update numbers n
set status=1, 
    some_id = (select some_id from newtable t where t.number_id = n.number_id)
where number_id in (select number_id from newtable);

它看一看你是否在问询中难以调取定点和更新价值。 通过使用约束性变量,你可以大大改善业绩。 有了约束性变量,Oracle只需要一个硬拷贝,用于所有24k完全相同的UNPDATE,而不是24k硬拷贝(和最新的执行计划)用于24k独特的UNPDATE报表。

With Java:

update numbers
set status = ?, some_id = ?
where number_id = ?;

利用其他工具:

update numbers
set status = :1, some_id = :2
where number_id = :3;

笔录 它一劳永逸。

或使用<条码> 预先声明,并批量您的请求。

他们可能要花太长的时间,因为你们每次都进行往返。 巴奇将帮助大事,因为你只进行一次往返。





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

How to make a one to one left outer join?

I was wondering, is there a way to make a kind of one to one left outer join: I need a join that matches say table A with table B, for each record on table A it must search for its pair on table B, ...

Insert if not exists Oracle

I need to be able to run an Oracle query which goes to insert a number of rows, but it also checks to see if a primary key exists and if it does, then it skips that insert. Something like: INSERT ALL ...

How can I store NULLs in NOT NULL field?

I just came across NULL values in NOT-NULL fields in our test database. How could they get there? I know that NOT-NULL constraints can be altered with NOVALIDATE clause, but that would change table s ...

Type reference scope

I m studying databases and am currently working on a object-relational DB project and I ve encountered a small problem with the number of possible constraints in an object table. I m using "Database ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

热门标签