Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Generate Keys/Constraints/Triggers?
>
>What can I say, I am spoiled by TOAD. In the schema/object browser, I
>can select a table then hit the 'Script' tab and see the alter table
>commands that build UK, FK (PKs are in CREATE TABLE), etc.
>
>Does someone have SQL statements that will result with the same DDL
>statements? I have seen some 'freeware' PL/SQL tools that require SYS.
>I don't have access to SYS, so these scripts would be written to use the
>views USER_CONS_COLUMNS and USER_CONSTRAINTS.
>
>Also, if you sell a tool that does this, you do NOT need to reply as I
>am not in the 'market' for purchasing something already in the Oracle
>data dictionary and that the guys who wrote TOAD figured out how to pull
>these DDL statements.
>
>Thanks
>Jeffery Cann
>
>
>
>
>
>
>
Have you tried looking in the online documentation for the syntax?
to add FK:
ALTER TABLE table_name
ADD CONSTRAINT fk_col_name FOREIGN KEY (column_name)
REFERENCES table_name(column_name);
Primary key is basically the same except for the REFERENCES part.
HTH
Sandy
Received on Mon Feb 28 2000 - 21:23:47 CST
![]() |
![]() |