I have a sql script in
dir:\some\path\script.sql
This script is executed via SqlDeveloper and spool
s some data into
dir:\some\path\data\tablename.csv
Now, I have to store the script in a .sql file because if I execute it from SqlDeveloper directly, spool
writes the query itself to the file which I do not want.
But I also do not want to hard-code paths because everyone in my team has their GIT repo whereever they want, so the scenario I'd like to achieve is that my sql script uses relative paths from it's location to write the csv files.
Currently the script.sql looks something like this:
SET COLSEP ";"
spool dir:\some\path\data\table1.csv
select /*csv*/ * from table1;
spool off;
and I want to look it something like this
SET COLSEP ";"
spool current_dir\data\table1.csv
select /*csv*/ * from table1;
spool off;
So that when using the script, the path has to be typed only once, when calling the script.