I wrote the following batch file to output table data to CSV file using Oracle SQLcl in Windows environment, but it doesn't work except to access the database.
Please teach me how to write correctly.
@echo off
echo set sqlformat csv^
echo set heading off feedback off^
echo spool c:\PIYO.csv^
echo select* from PIYO^
echo spool off | C:\sqlcl\bin\sql-Luser/password@//172.16.xx.xxx:1521/HOGE.FUGA
Interactive execution of the following results in a CSV file output:
cd C:\sqlcl\bin
sql user/password@//172.16.xx.xxx:1521/HOGE.FUGA
SQL>set sqlformat csv
SQL>set heading off feedback off
SQL>spool c:\PIYO.csv
SQL>select* from PIYO;
SQL>spool off
I wrote a batch file referring to the solution of my Stack Overflow.
sql oracle
^&
is missing compared to our solution.
@echo off
echo set sqlformat csv^&^
echo set heading off feedback off^&^
echo spool c:\PIYO.csv^&^
echo select* from PIYO^&^
echo spool off | C:\sqlcl\bin\sql-Luser/password@//172.16.xx.xxx:1521/HOGE.FUGA
© 2024 OneMinuteCode. All rights reserved.