Home » SQL & PL/SQL » SQL & PL/SQL » Foreign Key and Primary Key Details...
Foreign Key and Primary Key Details... [message #390366] |
Fri, 06 March 2009 02:31  |
ORAGENASHOK
Messages: 240 Registered: June 2006 Location: Chennai
|
Senior Member |
|
|
I have a query below which extract Foreign Key and Primary Key Details when i execute this i got error mentioned below.i cant fix it
Can anyone fix the Below.
Error: ORA-00933: SQL command not properly ended
SELECT DISTINCT
b.table_name Table_Name,
b.column_name Column_Name,
DECODE (a.constraint_type,'R', 'Referencial Integity(Foreign Key)','P','Primary
Key',' ') Constraint_Type,
a.constraint_name Constraint_Name,
a.r_constraint_name Reference_Constaint_Name,
b.POSITION pos,
c.table_name Reference_Table_Name,
c.column_name Reference_Column_Name,
b.POSITION pos1,
c.POSITION pos2
FROM all_constraints a, all_cons_columns b, all_cons_columns c
WHERE
a.constraint_name = b.constraint_name
AND a.constraint_type = 'R'
AND a.table_name = 'SE_T_PARENT_SUPPORT_MAP'
AND b.table_name = a.table_name
AND a.r_constraint_name = c.constraint_name(+)
AND b.POSITION(+) = c.POSITION
ORDER BY b.POSITION, c.POSITION
union
select distinct
a.table_name Table_Name,
b.column_name Column_Name,
decode(constraint_type,'C','Check Constraint','P','Primary Key','U','Unique key'
,'V','With Check Option',' ') Constraint_Type,
a.constraint_name Constraint_Name,
' ' Reference_Constaint_Name,
' ' Pos,
' ' Reference_Table_Name,
' ' Reference_Column_Name,
' ' Pos1,
' ' Pos2
from all_constraints a,all_cons_columns b
where
a.CONSTRAINT_NAME = b.CONSTRAINT_NAME AND
a.TABLE_NAME = b.TABLE_NAME AND
a.table_name = 'SE_T_PARENT_SUPPORT_MAP' AND
a.constraint_type !='R'
order by a.constraint_name;
|
|
|
Re: Foreign Key and Primary Key Details... [message #390369 is a reply to message #390366] |
Fri, 06 March 2009 02:39   |
 |
Michel Cadot
Messages: 68737 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Use SQL formater and copy and paste your sqlplus session.
And why is this in "Server Utilities"? Is this a "Datapump, Import, Export, SQL*Loader, TKPROF, asmcmd, nid, orapwd, etc." question? Does "SQL command not properly ended" mean this?
Regards
Michel
[Updated on: Fri, 06 March 2009 02:40] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Feb 15 12:12:45 CST 2025
|