Forums Register Login

Drop Primary Key Constraint

+Pie Number of slices to send: Send
Hello everyone,
I have a form with fields sno, sname. I added a new field 'class' which is a list box with values 1 to 10.All the information related to sno, sname and class are stored in the student table.The class field has primary key.Now i want to drop the primary key which exists on this class field. So I executed "alter table student drop primary key(class);
It displayed an error message:ORA-01735:invalid alter table option. The reason why I want to drop this primary key is because when i try to open the legacy records on this form which do not have this new field does not allow me to save this form as this field has primary key constraint. If I can drop this constarint then I can update the student table with some default value in this class field for the legacy records as this field would be null for those records.Could any one let me know how to drop the primary key ?
Thanks,
Prathima
+Pie Number of slices to send: Send
Prathima,
You can't drop a primary key altogether. You would need to pick a different column or columns to be the primary key instead.
+Pie Number of slices to send: Send
I suppose you can do that. In fact, your query was wrong.

Try this,
+Pie Number of slices to send: Send
 

Originally posted by Jeanne Boyarsky:
You can't drop a primary key altogether. You would need to pick a different column or columns to be the primary key instead.



It is not like, we have to have a primary key in a table. I believe, you can't drop a primary key when there is a reference (foreign key) present. And in that case the complaint would be different.
It's a tiny ad only because the water is so cold.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2394 times.
Similar Threads
how to the setNull() method
how to the setNull() method
Primary key problem
To identify Primary Keys in a table
Data Conversion Process
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:32:52.