SQL Plus call SQL script with dynamic spool path
Kerstin Volkenand, February 14, 2018 - 2:49 pm UTC
I use to open QLPLUS and then start as script: via @ W:\SG-323\TeamZentraleKatalogredaktion\Bankleitzahlen\Q1_2018\ZD_ZZB-einspielen-insert-Aenderungskennz-A-M-testspool.sql and had removed the NLS_LANG settings, but it is still the same message,
only when I use path for sppol with @ select 'H:\Dokumente\SQL\Q' || to_char(sysdate,'Q') || '_' || to_char(sysdate, 'yyyy')|| '\ZD_ZZB-einspielenAenderungskennz-A-M-testspool-hardcodiert.txt' filename from dual;
not when path is hardcoded.
SQL Plus call SQL script with dynamic spool path
Kerstin Volkenand, February 14, 2018 - 3:13 pm UTC
I use SQL plus command line and call with @ W:\SG-323\TeamZentraleKatalogredaktion\Bankleitzahlen\Q1_2018\ZD_ZZB-einspielen-insert-Aenderungskennz-A-M-testspool.sql
The message is only when I use dynamich path as
select 'H:\Dokumente\SQL\Q' || to_char(sysdate,'Q') || '_' || to_char(sysdate, 'yyyy')|| '\ZD_ZZB-einspielenAenderungskennz-A-M-testspool-hardcodiert.txt' filename from dual;
independent of the language settings.
February 22, 2018 - 1:39 am UTC
OK, try this:
C:\temp>set NLS_LANG=american_america.WE8PC850
C:\temp>sqlplus scott/tiger
SQL*Plus: Release 12.2.0.1.0 Production on Thu Feb 22 09:37:06 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Last Successful login time: Sat Feb 17 2018 09:49:47 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> spool c:\temp\ZD_ZZB-einspielenÄnderungske.dat
SQL> select * from dual;
D
-
X
SQL> spool off
SQL> define f = c:\temp\ZD_ZZB-einspielenÄnderungske.dat
SQL> set verify off
SQL> select '&&f' from dual;
'C:\TEMP\ZD_ZZB-EINSPIELENÄNDERUNGSKE.DAT
-----------------------------------------
c:\temp\ZD_ZZB-einspielenÄnderungske.dat
SQL> spool &f
SQL> select sysdate from dual;
SYSDATE
---------
22-FEB-18
SQL> spool off
SQL>