Re: Grrr! How do you make sqlplus exit on a syntax error!

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Fri, 11 Oct 2002 15:27:45 GMT
Message-ID: <3DA6EDCC.195EC257_at_exesolutions.com>


Niall Litchfield wrote:

> "Daniel Morgan" <dmorgan_at_exesolutions.com> wrote in message
> news:3DA5BE71.87C125DF_at_exesolutions.com...
> > I'll try again.
> >
> > What's wrong with:
> >
> > BEGIN
> > ... your SQL statement here
> > ... your SQL statement here
> > ... your SQL statement here
> > END;
> > /
> >
> > Seems to me the functionality requested already exists. Just wrap BEGIN
> and END
> > around your SQL.
>
> Sqlplus scripts do not necessarily just consist of sql
>
> SQL> begin
> 2 set echo off
> 3 execute immediate 'select sysdate from dual';
> 4 end;
> 5 /
> set echo off
> *
> ERROR at line 2:
> ORA-06550: line 2, column 6:
> PL/SQL: ORA-00922: missing or invalid option
> ORA-06550: line 2, column 2:
> PL/SQL: SQL Statement ignored
>
> SQL>
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> *****************************************
> Please include version and platform
> and SQL where applicable
> It makes life easier and increases the
> likelihood of a good answer
>
> ******************************************

Try running your SQL statement at the SQL*Plus command line and let me know how it works?

Connected to:
[Quoted] Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production With the Partitioning option
JServer Release 8.1.7.0.0 - Production

SQL> execute immediate 'select sysdate from dual'; BEGIN immediate 'select sysdate from dual'; END;

                *

ERROR at line 1:
ORA-06550: line 1, column 17:
PLS-00103: Encountered the symbol "select sysdate from dual" when expecting one of the following:
:= . ( _at_ % ;
[Quoted] The symbol ":=" was substituted for "select sysdate from dual" to continue.

SQL> [Quoted] Of course it isn't the solution to every problem: What is? But it sure works [Quoted] with 90% of the SQL run from scripts which is mostly insert, update, and delete.

Daniel Morgan Received on Fri Oct 11 2002 - 17:27:45 CEST

Original text of this message