How to execute .SQL files from console

Very easy, just log in into sqlplus and type as follows if you are in the same path as your file:

SQL > @file_name.sql

If you are not in the same path as your file, you should type as follows:

SQL > @/path/to/file_name.sql

What if I need to pass a parameter? Well, not a problem, just type as follows:

SQL > @file_name.sql param1 param2

or

SQL > @/path/to/file_name.sql param1 param2

Sources

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: