Now I have a script, how do I run it in SQL Dev? In SQL*Plus, I would run it like @clean_tables. Two things to note there, 1, I didn't have to put the extension on the file and b, I assumed SQL*Plus was running from the directory where my file was located. If I was running the script from a different directory, I would have to use either a relative path...or something, but I digress.
I wanted to be able to run my script in a SQL Developer worksheet. How?
@clean_tables Error starting at line 38 in command: @clean_tables Error report: Unable to open file: "clean_tables.sql"
Twitter. Jeff Smith hangs out there, a lot. He supposedly has a real job as the Senior Assistant Principal Skinner Product Dude for SQL Developer at Oracle. Crazy title, I know. Back to Twitter.
@oraclenerd working directory would be directory of parent file— Jeff Smith (@thatjeffsmith) February 22, 2013
Since he lives there (Twitter) (and I'm glad he does), I got an immediate response. Yay for Jeff.
Wait, what? Parent file? WTF are you talking about?
(I then remove the snark and try to put more details)
(oh, and I don't like that I can't just embed a single tweet...sorry, their fault, not mine)
@thatjeffsmith "@ test(.sql)" I just want to know where to put test.sql.— oraclenerd (@oraclenerd) February 22, 2013
Two seconds later:
@oraclenerd i think this, Tools > Preferences > Database > Worksheet > Select default path to look for scripts. Please test :)— Jeff Smith (@thatjeffsmith) February 22, 2013
Tested, and it works. Yay for me. Yay for Jeff.
In case it isn't obvious, I'm being sarcastic. Jeff is a fantastic advocate for SQL Developer. Yes, he gets paid to do it, but he goes above and beyond on a daily basis. Oracle is lucky to have him.