Forum Stats

  • 3,750,259 Users
  • 2,250,141 Discussions
  • 7,866,877 Comments

Discussions

SQLcl resolving Windows system variables

DaveH
DaveH Member Posts: 1
edited Feb 2, 2018 6:56PM in SQLcl

I'm curious if I'm doing something wrong related to SQLcl or it's a problem with the product itself, but it doesn't seem to properly resolve Windows system variables.  For example:

SQL> host echo %SQLPATH%

C:\Oracle\sql

SQL> store set %SQLPATH%\x.sql replace

        java.io.FileNotFoundException: %SQLPATH%\x.sql (The system cannot find the path specified)

        at java.io.FileOutputStream.open0(Native Method)

           ...

        at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.main(SqlCli.java:477)

Error: %SQLPATH%\x.sql (The system cannot find the path specified)

Wrote file %SQLPATH%\x.sql

SQL> host dir %SQLPATH%\x.sql

Volume in drive C is OSDisk

Volume Serial Number is 30C1-3448

Directory of C:\Oracle\sql

File Not Found

The same steps work fine using sqlplus from the Oracle client.  I'm on Windows10 and running SQLcl 17.4.0.354.2224.

Dave

Answers

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited Feb 2, 2018 6:56PM

    This is a bug with the STORE command.  It seems that SQLcl's HOST command handles %<env_var>% strings, but STORE does not.

    Strangely enough, the situation in SQL*Plus is exactly the opposite...

    HostCommandInSQLclVersusSQLPlus.jpg

    SQL*Plus handles such environment variables in the STORE command, but not in HOST (the STORE case not shown above, but it worked fine.)

    Please report bugs by opening a Service Request with My Oracle Support.