Does SQLDeveloper support executing scripts?

后端 未结 6 849
梦毁少年i
梦毁少年i 2020-12-13 04:38

I was trying to follow some instructions today, and it starts with the comment


REM  In SQLPlus I manually copy in each line and execute it.
相关标签:
6条回答
  • 2020-12-13 04:55

    you can do it using sqlcl in the same way how you would do it using SQL PLUS, from command line:

    sqlcl user/password@host:port:sid @file.sql
    

    file should be in the same directory where sqlcl is.

    This solution is the best option if you are trying to execute a lot of instruction on sql file.

    0 讨论(0)
  • 2020-12-13 04:56

    SQL Developer these days comes with another tool called sqlcl. This is a bit like SQLPlus but is actually using some bits from SQL Developer to give a compatible command line/scripting type interface.

    You would be able to use it to execute sqlplus style commands without fighting the extras of the SQL Developer style GUI which can get confusing.

    Look for it under wherever SQL Developer is sitting. If you don't have it there, you can download it and deploy it into your sqldeveloper folder.

    0 讨论(0)
  • 2020-12-13 04:57

    This would do it:

    begin
        procedure_name ('parameter1', 'parameter2');
    end;
    /
    
    0 讨论(0)
  • 2020-12-13 05:03

    For each file you need to run, find it and drop it into SQLDeveloper. Run the script (F5) and then commit (F11). This will work for some scripts, but not all.

    0 讨论(0)
  • 2020-12-13 05:08

    To run scripts in SQL Developer:

    @"\Path\Scriptname.sql"
    

    (You only need the quotes if there are any spaces)

    You can set a default Path: Tools menu > Preferences > Database > Worksheet > Select default path to look for scripts

    0 讨论(0)
  • 2020-12-13 05:16

    I was looking through the help files and found how to do it in SQL Developer Concepts and Usage->Using the SQL Worksheet->Script Runner.

    Basically, you have to precede the file name with an @. For example @C:\MyScript\Script.sql.

    You can then run a batch of them this way. Note that the command doesn't seem to like spaces in the file path.

    0 讨论(0)
提交回复
热议问题