A customer ‘ambushed me’ – how dare they!?! – at the conference today, needing help getting their scripts to work.
So something like this:
And the way the customer wants to run scripta.sql (which calls scriptb.sql)
So, where is SQL Developer going to look for scriptA? And when it gets to the @child\scriptb.sql?
We can call scripts.sql using
But, we’re going to have a problem.
So, you have 2 options.
First, you COULD tell SQL Developer where to look explicitly for your scripts in the preferences.
So what’s your second option?
So, What Do We Do?
Use the CD command
It’s a command we added to SQLcl. It’s pretty simple. It changes the directory we read from, and write to.
I am HR ON orcl > help cd CD --- Changes path TO look FOR script at after startup. (SHOW SQLPATH shows the FULL SEARCH path currently: - CD CURRENT directory setting SET BY LAST cd command - baseURL (url FOR subscripts) - topURL (top most url WHEN starting script) - LAST Node opened (i.e. file IN worksheet) - WHERE LAST script started - LAST opened ON sqlcl path related file chooser - SQLPATH setting - "." IF IN SQLDeveloper UI (included IN SQLPATH IN command line (sdsql)) ). I am HR ON orcl>
So, knowing this, let’s see JUST where SQLDev is looking for files.
Since I had used the CD, it’s looking in THAT directory first. Then it’s looking here:
SQLPATH : C:\Users\jdsmith\Desktop\Parent;C:\Users\jdsmith\AppData\Local\Temp\;C:\Oracle\product\12.1.0\client_1\dbs;c:\Users\jdsmith\Desktop;.
And By The Way…
If you’re ever at a conference, ALWAYS take the opportunity to approach Oracle Database product managers. It’s what we’re here for. Direct feedback is one of the most valuable things we get from leaving our little caves