Home > Mobile >  ORA-00933 error but the query have correct clauses
ORA-00933 error but the query have correct clauses

Time:12-01

I have "ORA-00933: sql command not properly ended" error in this query:

SELECT FILIALE_CHIUSA FROM FILIALI_CHIUSE WHERE FILIALE IN (9909);

The table is

CREATE TABLE FILIALI_CHIUSE (
                              FILIALE NUMBER(5,0) NOT NULL,
                              FILIALE_CHIUSA NUMBER(5,0) NOT NULL
                           );

I have checked but the query seems right and with not erroneous clauses, so where is the problem?

CodePudding user response:

Invalid create table statement; Oracle doesn't support if not exists.

SQL> CREATE TABLE IF NOT EXISTS FILIALI_CHIUSE (
  2                                FILIALE NUMBER(5,0) NOT NULL,
  3                                FILIALE_CHIUSA NUMBER(5,0) NOT NULL
  4                             );
CREATE TABLE IF NOT EXISTS FILIALI_CHIUSE (
                *
ERROR at line 1:
ORA-00922: missing or invalid option

Without that clause:

SQL> CREATE TABLE FILIALI_CHIUSE
  2    (FILIALE NUMBER(5,0) NOT NULL,
  3     FILIALE_CHIUSA NUMBER(5,0) NOT NULL
  4    );

Table created.

select also works (though, doesn't return anything as table is empty):

SQL> SELECT FILIALE_CHIUSA FROM FILIALI_CHIUSE WHERE FILIALE IN (9909);

no rows selected

SQL>

CodePudding user response:

The problem is related to the final semicolon, that wasn't processed correctly. Removing it solved.

  • Related