This query returns 1 row:
SELECT col1, col2 FROM table1 WHERE col1 = :column1;
But this updates 0 rows:
UPDATE table1 SET col2 = :column2 WHERE col1 = :column1;
COMMIT;
I added this constraint to set col1 as primary key, but it didn't fix it.
ALTER TABLE table1 ADD CONSTRAINT col1_pk PRIMARY KEY (col1);
I am trying this from SQL Developer, any idea why it does not update the row?
EDIT:
col1 is VARCHAR2(32 BYTE) NOT NULL
col2 is CLOB NOT NULL
EDIT 2: Test Case, set :var1 to 0011223344556677 in the select and update sentences.
CREATE TABLE MY_TABLE
( COL1 VARCHAR2(32 BYTE) NOT NULL ENABLE,
COL2 CLOB,
CONSTRAINT "MY_TABLE_PK" PRIMARY KEY ("COL1")
)
INSERT INTO MY_TABLE (COL1, COL2) VALUES ('0011223344556677', '1434407992143440799214344079921434407992');
SELECT * FROM MY_TABLE WHERE COL1 = :var1;
UPDATE MY_TABLE SET COL2 = 'test' WHERE COL1 = :var1;
COMMIT;
selectreturns a single row, theupdatewill modify exactly 1 row assuming they are run in the same context. If yourselectis run in a session where the row it is selecting is uncommitted and theupdateis run in a different session, then theupdatewon't see the row in question. If some other session deletes the row before theupdatehappens and commits the change, then theupdatewill update 0 rows. Sort of that, though, it would be helpful to provide a test case that shows that the row is actually not being updated.updatemodifies 0 rows? If all this is being done in a single session and theselectreturns a row, either the bind variable value is actually different for the two statements or you're not actually executing theupdateor theupdateis modifying a row and you are missing it.