0

I am working on a database and my task is to enter the logic.

What I need to know is: is it possible, with ORACLE SQL DEVELOPER, using the function "script table as" ?

With SQL Server, for example, I can right click on the table, click on "script table as" and get the script with all of the information (FK, contraints, ecc...).

The table is named "STRUTTURE" and is part of the user schema "SAO".

So the "full name" is "SAO.STRUTTURE".

I found out a command like this online:

set long 50000
/
select dbms_metadata.get_ddl( ‘TABLE’, ‘EMP’, ‘SCOTT’ ) from dual

but does not work.

Any one can help me?

Thank you very much in advance!

2
  • 3
    What do you mean it does not work? What exactly happened? Did you replace the object and schema names in the query so they relate to your actual table? Commented Nov 16, 2020 at 8:31
  • 2
    Please, never, never, never use 'doesn't work' when asking questions, because it can mean anything, including you ran it in the tool that is not supposed to run that code. Do you have any errors? So post them (as plain text with copy-paste). Do you have results you didn't expect? So post them and add what did you expected. Commented Nov 16, 2020 at 8:35

1 Answer 1

4

When you select a table, on the right hand side you see information related to it (displayed as tabs):

  • columns
  • data
  • ...
  • SQL --> that's the one you're looking for

You didn't mention which SQL Developer version you use; maybe you'll have to upgrade (it is free) if your version doesn't have that tab.

Sign up to request clarification or add additional context in comments.

1 Comment

you can also use the DDL command in a worksheet, or right click on an object in the tree and Quick DDL > to worksheet/file/clipboard

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.