Open and Run
File → Open (or Ctrl+O)
Select your .sql file
Choose a database connection
Press F5 to run
Execute .sql files, run multiple queries at once, and automate your database tasks. This guide covers everything from basic script execution to advanced options.
# Execution modes
run_statement = Ctrl+Enter # single statement at cursor
run_script = F5 # entire worksheet
script_output = F8 # view Script Output panel
# File support
file_type = .sql
max_size = unlimited
encoding = UTF-8 (configurable)
time = 1 minute
difficulty = Beginner
// three ways to open and run shown below
Know the difference — the two modes show results differently and target different parts of your worksheet.
Three ways to execute your scripts — pick the one that fits your workflow.
File → Open (or Ctrl+O)
Select your .sql file
Choose a database connection
Press F5 to run
Drag your .sql file directly into SQL Developer's editor area. It opens in a new tab. Select connection and press F5.
In any worksheet, type:@C:\path\to\script.sql
Then press F5. Also works for running scripts from within other scripts.
When you run a script with F5, output appears in the Script Output panel at the bottom of the editor.
Tip: If you don't see Script Output, go to View → Script Output or press F8.
Three SQL*Plus directives for production-grade scripts.
-- Use &name in your script — SQL Developer prompts when you run it
SELECT * FROM users WHERE id = &user_id;
-- Save script output to a file
SPOOL C:\output.txt
SELECT * FROM users;
SPOOL OFF
-- Stop execution if any statement fails — useful for deployments
WHENEVER SQLERROR EXIT;
-- ... rest of your script
Four scenarios that trip people up, with fixes.
WHENEVER SQLERROR EXIT. Remove it to continue past errors.Complementary tasks for working with scripts.
Once a script runs and you have results, the typical next steps are exporting the output (CSV/Excel/JSON) or importing more data to follow up. Both use the same Data Wizard you already know.
See also: Import CSV · Keyboard Shortcuts · Don't have it yet? Download SQL Developer