This content has been marked as final. Show 7 replies
EXECUTE IMMEDIATE 'ALTER TABLE your table DISABLE PRIMARY KEY';Just keep in mind if PL/SQL program you are talking about is stored object with definer rights object owner must have proper privileges granted directly, not via role - stored object with definer rights ignore roles.
Edited by: Solomon Yakobson on Aug 4, 2011 4:31 PM
Thanks a lot
I have this problem:
I performed "EXECUTE IMMEDIATE 'ALTER TABLE your table DISABLE PRIMARY KEY';"
but when I performed "insert into table ...."...Oracle returns ora-0001.
Database: Oracle 220.127.116.11
How is it possible?
Thanks in advance.
Perhaps there is also a unique key or index, in addition to the primary key that you disabled?
for you question, better you start a new thread..
and can you post the output result of
have you done it inside any stored object or on the sql promt?
"EXECUTE IMMEDIATE 'ALTER TABLE your table DISABLE PRIMARY KEY';"
And thenafter: from where are you performing insert?
Are those both statements part of the same stored object or the session?
First, think really hard about why you want to disable the PK. If it turns out that you really must change the PK, then do this:
1. drop the primary key.
2. recreate the PK with the DEFERRABLE INITIALLY DEFERRED clause.
This will cause the PK to be created with a non-unique index so that if you disable the PK, you will not get an ORA-1 exception. It will also defer checking and enforcing the PK until you commit. This could eliminate the need to disable/enable the PK.