Editing and public synonyms
Posted: Fri 09 Jul 2010 13:53
I have a situation where a table exists in another schema and there is a public synonym that points to it. It appears that in this case ODAC (latest version under Delphi 2010) doesn't pick up the primary key of the table and so doesn't use it in any of the generated locking or refreshing statements.
If you select using the public synonym then the locking statement used when updating the record will be:
If you select from the table directly the locking statement will be aware of the primary key:
Thanks for any comments.
-Mark
Code: Select all
create table ddl.testtable (id number(38) primary key, vc varchar2(100));
insert into ddl.testtable values (1, 'ODAC');
commit;
create public synonym ddltesttable for ddl.testtable;
select * from ddltesttable; <-- does not see primary key
select * from ddl.testtable; <-- does see primary key
Code: Select all
SELECT * FROM "DDLTESTTABLE"
WHERE
"ID" = :"Old_ID" AND "VC" = :"Old_VC"
FOR UPDATE NOWAIT
Code: Select all
SELECT * FROM "DDL"."TESTTABLE"
WHERE
"ID" = :"Old_ID"
FOR UPDATE NOWAIT
-Mark