PLSQL How to execute other scripts from a script?

Its been almost a decade since this was asked, is this still the case?


I would like to move from Toad or SQL Developer to Datagrip, but cannot seem to execute scripts that use the @@ reference.


//update tableA


//update tableB


 Currently, after setting the dialect, it recognizes the actual sql in the main script but just ignores all script references.  Am I missing something on how to do this?


Nicholas Aupke, at the moment DataGrip users a bit different paradigm of Run Configurations where you can set a desired order.


I would like to use the Run Configuration feature to simplify rebuilding my database. I have two scripts - one that drops and recreates the schema (including all tables) and another that regenerates all views. Both include “use” statements.

In the Run/Debug Configurations dialog, I get a warning that my scripts contain schema switches, which is OK. However, even when I select a data source (DB server) only (no schema), I still see these warnings. It seems that if only a data source is selected, the warnings should not apply.



Yes, that's a warning you'd get when switching schemas in your script:

Please provide a sample of your script where schema switching is not applied. You can just include basic statements without specifying routine details.

We'll have a look.

Thank you for the response. I understand the need for the warning when a schema is selected as part of the data source. I am just wondering if the warning should be displayed when a schema is not selected. In that case, the script would be required to contain “use” statements, so perhaps it should not trigger a warning in this configuration.


I have just run a MSSQL script with use statements where I used different databases, but couldn't catch any warnings in the output in 2024.1.1 version. May I know your   current IDE version and the database over which you executed your script  from Run Config section?

The warnings are in the dialog, not the script output.

As you can see, I have not selected a schema in my configuration. My scripts would therefore have to include a “use” statement, or they would not work. I am suggesting that the UI not display the warning icon in this case. In fact, it might actually make more sense to display a warning if a script does not include a “use” statement when no schema is selected.

Thanks, we were able to reproduce it.

We'll follow up with more information soon.
As it's turned out, this is an expected behavior and should behave this way by default. However, according to your screenshot, you're either connecting to a server directly without specifying a schema in the URL, or the data source is not introspected. Normally, it would prompt for a default schema. There were some issues with the way USE statement is applied to MSSQL databases in the run config scripts - the warning is also shown in this case. We'll fix the missing spots.

Thanks for the update. I actually don't want to be prompted for the schema, since my script drops the schema and re-creates it. I use this feature to ensure that I have a clean database before kicking off a test run. Prompting for the schema would break my workflow.


You should not get any prompt during the execution. It's just a warning informing you about using other schema. It should break your workflow due the execution of both scripts.

OK, thank you for confirming.


Please sign in to leave a comment.