Search code examples
oracleoracle-sqldeveloperentity-relationship

Generate ER diagram from SQL Script


I have some SQL scripts written in a .sql file I need to generate ER diagram using those scripts, so that I can verify the relationships and then get them executed in the DB.

Can anyone help me on how I can achieve this? I would prefer doing this in SQLDeveloper

EDIT: As ismetguzelgun suggested me in his answer to execute the scripts first and then export the diagram through data modeler. I do not have the permission to execute DML commands in the Database and I do not have any other database as well where I can execute this. So that option is not going to work out for me.


Solution

  • Just use the import feature.

    File - Data Modeler - Import - DDL Script

    enter image description here

    Point to one or more .sql files.

    enter image description here

    A dialogue will appear showing what's about to be added to your design. Make sure everything's checked and hit the Merge button.

    enter image description here

    Your new/existing design is ready!

    enter image description here

    If you don't see anything in the diagram area, zoom out or use the Navigator window to make sure you're in an area with your tables. Or use the tree on the left, pick a table, and right click, 'Go to Diagram' - it will take you directly to that object in the diagram.