-
DESC in primary key
Does anyone know of a way to have a DESC function on a column in a primary key? Below is what I've tried and the results:
create table tab1 (col1 number, col2 number, col3 number);
alter table tab1 add constraint pk1 primary key (col1) using index
(create index indx1 on tab1 (col1 desc));
alter table tab1 add constraint pk1 primary key (col1) using index
*
ERROR at line 1:
ORA-01418: specified index does not exist
I've also tried:
create unique index indx1 on tab1 (col1 desc);
alter table tab1 add constraint pk1 primary key (col1) using index indx1;
with the same results.
Any ideas?
Thanks,
J
-
SQL> create table tab1
2 (col1 number,
3 col2 number,
4 col3 number);
Table created.
SQL> create index indx1 on tab1 (col1 desc);
Index created.
-
Thanks. I knew I could do it that way, but I was specifically trying to get a "Primary Key". Technically, there's no difference, but some of our scripts are looking for the primary key constraints (where constraint_type = 'P'), and we were trying to keep from rewriting our scripts.
J
-
You do not alter the database to conform to your code. The data will be there long after your app has come and gone. This is a perfect example of why most DBA's want to shoot developers!
MH
Last edited by Mr.Hanky; 02-25-2004 at 05:09 PM.
I remember when this place was cool.
-
I would normally agree, but in this case, I'm the DBA and developer. It's not a big deal, but if it was possible I would rather keep the database consistent, and there is only one table out of 300 that I'll have without a true PK.
-
Well, you should still find a developer to shoot!
Just on priciple.
MH
I remember when this place was cool.
-
Works for me! But can it be more than one...
-
Originally posted by Mr.Hanky
Well, you should still find a developer to shoot!
Just on priciple.
MH
Oh no, I'm condemmed to suicide.
-
i just want to know
what is advantage of building the index as descending?
-Raja
-
Shooting Develinterlopers
Cheer up DaPi, at least you can say it is on your terms
Has Mr. Hanky always been this way, what with wanting to shoot developers at will...?
Rick
Rick
Sigh.....those were the days my friend, I thought they'd never end.
I too remember when this place was coo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|