473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

I have to find the primary key of a table in oracle

I have to find the primary key of a table in oracle and I am typing this command SELECT * FROM ALL_CONS_COLUMNS A JOIN ALL_CONSTRAINTS C ON A.CONSTRAINT_NAME = C.CONSTRAINT_NAME WHERE C.TABLE_NAME = ACTIVE_MAINTENANCE_REQUEST AND C.CONSTRAINT_TYPE = 'P';

but it is giving the error
ERROR at line 1:
ORA-00904: "ACTIVE_MAINTENANCE_REQUEST": invalid identifier
Mar 18 '12 #1
2 2453
Luuk
1,047 Expert 1GB
Because ACTIVE_MAINTENTANCE_REQUEST is a table name, you should put quotes (') around it, like you did with the 'P' for the contraint_type
Mar 18 '12 #2
debasisdas
8,127 Expert 4TB
Better to use
USER_CONS_COLUMNS A JOIN USER_CONSTRAINTS

in place of
ALL_CONS_COLUMNS A JOIN ALL_CONSTRAINT
Mar 19 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rahul | last post by:
I am getting the following exception when accessing one of my tables. java.lang.reflect.InvocationTargetException: java.lang.ArrayIndexOutOfBoundsException at...
2
by: Graham Mattingley | last post by:
If I insert a value into a table what is the best way to find the Primary Field Value.. +--------------+---------------------+------+-----+ | Field | Type | Null | Key |...
4
by: alan | last post by:
What query do I use to list the primary key for each user table, i.e. TABLE | PRIMARY_KEY | Regards, Alan *** Sent via Developersdex http://www.developersdex.com ***
2
by: Brad | last post by:
Thanks for taking the time to read my question. I have code that I am using to tell me info about fields in a table. It is in a loop so I can move through all the fields in the table. ...
0
by: tomzam | last post by:
I'm trying to get mysql working on Fedora Core 4. Actually trying to start the program mysqld without fatal errors. I posted this message first on the linux misc group - but no luck so far. Maybe...
26
rsrinivasan
by: rsrinivasan | last post by:
Hi, 1. I have some table. But i do not know how to find primary key column, forign key column in that table. Is any procedure or function is available in oracle to find this?. Thanks,...
3
by: Larry Leonard | last post by:
Running MSDE 2000 SP2 on Windows XP SP3. I have a T-SQL script that is relatively simple (adding constraints, inserting rows, etc.) and short (maybe 300 lines, heavily commented). It's an...
6
jinalpatel
by: jinalpatel | last post by:
I am getting this error when I try to enforce referencial integrity from Harvest II table to tractsum table I have attached the relationship diagram. Please give me the hint about possibilities of...
0
by: conrad | last post by:
How to find the table dependency information for stored procedures in db2, I want to see which stored proc are link to a table.
0
by: hari korrapati | last post by:
hi i have created one view in datacom and now i forgot on which table i created.My question is how to find a table name for created view with the help of SQl
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.