This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,831 Users
  • 2,269,775 Discussions
  • 7,916,823 Comments

Discussions

SQLcl - Start sql script on MS Windows with a defined path

Gunther Pippèrr
Gunther Pippèrr GermanyMember Posts: 38 Bronze Badge
edited May 17, 2016 9:52AM in SQLcl

Hello Team,

how I can escape the \ in the path to a sql script in SQLcl to call the script?

I get the following errror  (sorry, German environment):

SQL> @c:\ps\sql\ls

Fehler beim Start in Zeile: 1 in Befehl -

@c:\ps\sql\ls

Fehlerbericht -

SP2-0310: öffnen von Datei nicht möglich: "c:pssqlls.sql"

Thanks

Best Regards

Gunther


PS:  I use  sqlcl-4.2.0.16.112.0616

Best Answer

Answers

  • Gunther Pippèrr
    Gunther Pippèrr GermanyMember Posts: 38 Bronze Badge
    edited May 3, 2016 6:40AM

    Hello,

    one workaround is the use of the ? Syntax, use Oracle Home and travers back to the original destination.

    For example:


    SQL> @?/../../../../../ps/sql/ls.sql


    Best Regards

    Gunther

  • BrianDwyer
    BrianDwyer Member Posts: 23
    edited May 3, 2016 6:47AM

    Hi, I'm using an earlier version (4.2.0.16.049.0843) and i'm able to call scripts without needing to put escape characters in.

    SQL> @D:\bob\bob

    Hello, My name is ob and I am called from D:\bob\bob.sql

    SQL>

    Wonder if it is just a bug in that release.

    Brian

  • Gunther Pippèrr
    Gunther Pippèrr GermanyMember Posts: 38 Bronze Badge
    edited May 3, 2016 7:35AM

    Hello Brian,

    If I start SQLcl with /nolog and connect later to a database the call of the script works!

    sql.bat /nolog


    SQLcl: Release 4.2.0.16.112.0616 RC auf Di Mai 03 13:18:38 2016

    SQL> @c:\ps\sql\hello.sql

    Hello World

    -- If I connect now to a database,

    SQL> connect [email protected]
    connected

    SQL>  @c:\ps\sql\hello.sql
    Hello World


    Only If I login first to a database I get the error!

    My next try is to set different NLS CHARSET's settings, maybe a charset problem?

    Best Regards

    Gunther

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Master Product Manager NC, USAPosts: 8,927 Employee
    edited May 3, 2016 11:07AM

    I think this is a bug.

  • BrianDwyer
    BrianDwyer Member Posts: 23
    edited May 6, 2016 5:49AM

    Hi, upgraded to the latest version and get the same issue so it is only in this release.

    the work around of sql /nolog then connecting from there gets round the issue. if you forget to do that then just use two \\ instead of one in the path

    the bug also stops you using the CD command to move around from within SQLcl.

    Brian

  • Gunther Pippèrr
    Gunther Pippèrr GermanyMember Posts: 38 Bronze Badge
    edited May 17, 2016 9:52AM Answer ✓

    Hello,

    I test the version 4.2.0.16.131.1023  from May 13, 2016 and it works now!

    CD is a nice feature!

    Thanks

    Best Regards

    Gunther