troubleshooting Question

running myfile.SQL from command line SQLPLUS 12c does not exit.

Avatar of Hec Ramsey
Hec RamseyFlag for United States of America asked on
* PL/SQLOracle Database
7 Comments2 Solutions250 ViewsLast Modified:
Hiya.  I am running a script saved as L:\MY_SCRIPT.SQL from command line.  

I want the script to execute, then close SQLPLUS.  
I am trying all the suggested code , adding EXIT. QUIT, . (period) to MY_SCRIPT.SQL  and get errors.
Without these statements the script runs successfully but SQLPLUS stays open.

Windows 7
Oracle 12C 1.0.2.0

Below is the command I cam using
C:\ sqlplus MY_SCHEMA/my_password@MY_DATABASE_LINK @L:\MY_SCRIPT.SQL

The script I am running is straight from Oracle documents:
DECLARE
    x   NUMBER := 100;
    BEGIN
        FOR i IN 1..10 LOOP
           IF MOD (i, 2) = 0 THEN    --i is even
             INSERT INTO temp VALUES (i, x, 'i is even');
           ELSE
             INSERT INTO temp VALUES (i, x, 'i is odd');
           END IF;
           x := x + 100;
       END LOOP;
   END;
   .
/



Below is the output including error:

SQL*Plus: Release 12.1.0.2.0 Production on Sat Apr 1 15:54:59 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Sat Apr 01 2017 15:50:29 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions
 .
   *
ERROR at line 14:
ORA-06550: line 14, column 4:
PLS-00103: Encountered the symbol "." The symbol "." was ignored.


THANKS!!!
ASKER CERTIFIED SOLUTION
johnsone
Senior Oracle DBA

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros