views:

1343

answers:

4

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.

That's nice, I don't have SQLPlus, I have SQLDeveloper. The lines that were pasted in were of the type:


@\\server\dir\dir\dir\commandfile1.txt;
COMMIT;

...etc.

It didn't like it when I tried that in a SQL window. I opened up and pasted in the commands by hand, and it wasn't happy with that either. (Did I mention that I'm not so good with this application nor Oracle, but that everyone else was out today?) The files there started with code like:


rem
set echo on
rem
execute procedure_name ('parameter1', 'parameter2');

A co-worker did have SQLPlus, and together we got it resolved. But, is there a way for me to do this with SQLDeveloper, so I'm not stuck if he's out too?

A: 

This would do it:

begin
    procedure_name ('parameter1', 'parameter2');
end;
/
David Aldridge
A: 

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.

Leigh Riffel
As you said, it works for some, but not all. I had to install SQL*Plus to do the rest.
thursdaysgeek
A: 

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.

jacket_and_hat
A: 

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