Forum Stats

  • 3,752,284 Users
  • 2,250,483 Discussions
  • 7,867,775 Comments

Discussions

Not able to run script in sqlcl

User_ZUUOD
User_ZUUOD Member Posts: 798 Bronze Badge
edited Jan 19, 2018 12:23PM in SQLcl

Hi All,

I am able to run SELECT * FROM DUAL; in sqlcl but When I try to run @ D:\Scripts\Explain_plan.sql nothing is happening.

Please advise why scripts are not getting executed.

pastedImage_0.png

jaramillGaz in OzJohn Thorton
«1

Answers

  • jaramill
    jaramill Member Posts: 4,299 Gold Trophy
    edited Jan 18, 2018 4:50PM

    My guess is that you are logged into the database via SQL* Plus, which you've executed from the command line that is of a Unix/Linux variety, but trying to run a script located on Windows path.

    So can you type these two things first (one at a time)

    SELECT *

      FROM v$version;

    Then type in the command "host".  What does it show?  are you in Windows prompt or a Unix/Linux prompt?

    For example, mine is Unix:

    pastedImage_0.png

  • John Thorton
    John Thorton Member Posts: 14,493 Silver Crown
    edited Jan 18, 2018 4:51PM
    2980262 wrote:Hi All,I am able to run SELECT * FROM DUAL; in sqlcl but When I try to run @ D:\Scripts\Explain_plan.sql nothing is happening.Please advise why scripts are not getting executed.
    pastedImage_0.png

    is there a space character between "@ and the D:\"?

    if so, please remove it & try again.

    jaramill
  • User_ZUUOD
    User_ZUUOD Member Posts: 798 Bronze Badge
    edited Jan 18, 2018 4:51PM

    Tried that as well but not working.

  • User_ZUUOD
    User_ZUUOD Member Posts: 798 Bronze Badge
    edited Jan 18, 2018 4:52PM

    No my DB version is 12.1 and host command shows windows as sqlcl is in my D directory of window machine.

  • John Thorton
    John Thorton Member Posts: 14,493 Silver Crown
    edited Jan 18, 2018 4:54PM
    2980262 wrote:Tried that as well but not working.

    When was last it worked without error?

    What changed since then?

    You have a mystery & give us no clues.

    How do I ask a question on the forums?

  • jaramill
    jaramill Member Posts: 4,299 Gold Trophy
    edited Jan 18, 2018 4:55PM
    2980262 wrote:No my DB version is 12.1 and host command shows windows as sqlcl is in my D directory of window machine.

    Ah I just realized you're using SQL CL (Command Line) which is the evolved version of SQL* Plus.

    Do you have access to SQL* Plus?  If so can you try the same thing again?

  • jaramill
    jaramill Member Posts: 4,299 Gold Trophy
    edited Jan 18, 2018 4:57PM
    John Thorton wrote:2980262 wrote:Hi All,I am able to run SELECT * FROM DUAL; in sqlcl but When I try to run @ D:\Scripts\Explain_plan.sql nothing is happening.Please advise why scripts are not getting executed.
    pastedImage_0.png

    is there a space character between "@ and the D:\"?

    if so, please remove it & try again.

    Good catch John, I didn't see that blank space there.

  • jaramill
    jaramill Member Posts: 4,299 Gold Trophy
    edited Jan 18, 2018 4:59PM
    2980262 wrote:Tried that as well but not working.

    What John mentioned is a good thing.  Can you show us that it is STILL not work when you remove the space?  Also before you run the script (or attempt to), type in the command "host", then type in the change directory command without a value.

    "cd" and show us what it says?

  • John Thorton
    John Thorton Member Posts: 14,493 Silver Crown
    edited Jan 18, 2018 5:04PM

    post  COPY & PASTE proof that Explain_plan.sql file exists & has correct OS  permissions for Oracle to invoke it.

    make a new text file called "now.sql" that contains the line below

    SELECT SYSDATE FROM DUAL;

    & do as below

    SQL> @now.sql

    COPY the results from above then  PASTE all back here

  • User_ZUUOD
    User_ZUUOD Member Posts: 798 Bronze Badge
    edited Jan 18, 2018 5:25PM

    Already tried the approach with SELECT * FROM emp; in a demo.sql but result is same.