Help: OnLine not deleting row
Posted in 1993
Everyone has been so helpful in this newsgroup that I thought I would try your patience with yet another problem. We have OnLine 5.0 supporting a DB with buffered log (non-mode ansi). The default isolation level, commited read, is in effect. I have three tables, comprising two objects in a many-to-many relationship: TABLE obj1 ( name CHAR (20) NOT NULL PRIMARY KEY, id SERIAL NOT NULL UNIQUE ); TABLE obj2 ( name CHAR (20) NOT NULL PRIMARY KEY, id SERIAL NOT NULL UNIQUE ); TABLE ptr ( id1 INTEGER NOT NULL REFERENCES obj1 (id), id2 INTEGER NOT NULL REFERENCES obj2 (id), dat SMALLIT NOT NULL ); In my ESQl/C program I do the following (usual sort of stuff): $begin work; $prepare ps_o2n from "select obj2 where name = ?"; $declare cs_o2n cursor WITH HOLD for ps_oin; $open cs_oin using :input->name; $fetch cs_o2n into :obj2; $close cs_o2n; ptr->id2 = obj2->id; $prepare pd_ptr2 from "delete from prt where id2 = ?"; $execute pd_ptr2 using :ptr->id2; $prepare pd_obj2 from "delete from obj2 where id2 = ?"; $execute pd_obj2 using :obj2->id; At this point, although sqlca.sqlcode is 0, the number of rows deleted is *also* zero, although the row obviously exists, and the delete of the references appears to have worked (ie that delete returned SQLOK with >0 rows). Could this have anything to do with the WITH HOLD on the select? (All these statements are really in general purpose subroutines, which is why the WITH HOLD is needed: certain selects take place outside transactions). Any insights would, as usual, be most appreciated. Thanks, Andrew Shaw AT&T Bell Labs andrew.shaw@att.com apache1shaw@att.com