Strange error - ORA-00928: missing SELECT keyword

Strange error - ORA-00928: missing SELECT keyword

Post by Da » Sat, 18 Aug 2001 01:44:00



I got the following error saying missing SELECT. But it has select and
the SQL seems OK with me. What could be wrong? Is this some sort of
bug? I use Oracle 8.1.6.0. Thanks.

--------------------------------------------------------------------

SQLException information

Exception 1
  Message        :ORA-00928: missing SELECT keyword
  SQLState       :42000
  SQL Error code :928
Exception 2
  Message        :ORA-00928: missing SELECT keyword
  SQLState       :42000
  SQL Error code :928
Statement
  ID             : 1187
  Interruptible? : NO
  Last   SQL     :

CREATE TABLE TTMMPP_517909_95 TABLESPACE MART_DATA NOLOGGING PARALLEL
1 PCTFREE 0 PCTUSED 40 AS SELECT
        NVL(DimRow0,NULL) DimRow0,
        NVL(DimColumn0,NULL) DimColumn0,
         NVL((COUNT( DISTINCT CASE WHEN F0_DCNT_1 <> 0 THEN F0_DCNT_1_C ELSE
NULL END)),(0)) F0_DCNT_1,
        0 g0,
        0 g1

 FROM (
 SELECT /*+use_hash(T0,T1,T2)*/
        NVL(T1.Business_Type,NULL) DimRow0,
        NVL(T1.Account_Status,NULL) DimColumn0,
         /*COUNT DISTINCT T1.Account_Number BOOK*/ (SUM (DECODE((
T0.transtype_key ),( 1 ),( 1) , (NULL) ))) F0_DCNT_1,
        T1.Account_Number F0_DCNT_1_C
 FROM  
        CALL_0_A        T0,
        CUSTOMER_0_B T1,
        DATE_0 T2
 WHERE  
        T0.group_key = T1.customer_key
        AND T0.date_key = T2.date_key
        AND (T2.cy_name IN ('2001'))
        AND T0.transtype_key IN (1)
 GROUP BY  
        T1.Business_Type,
        T1.Account_Status,
        T1.Account_Number
HAVING  SUM(T0.Existence) <> 0  
 ) T  GROUP BY  
        DimRow0,
        DimColumn0

 
 
 

Strange error - ORA-00928: missing SELECT keyword

Post by Carl Hathawa » Sat, 18 Aug 2001 18:46:17


Is the following valid syntax?
DISTINCT CASE WHEN F0_DCNT_1 <> 0 THEN F0_DCNT_1_C ELSE
NULL END)),(0)) F0_DCNT_1,

> I got the following error saying missing SELECT. But it has select and
> the SQL seems OK with me. What could be wrong? Is this some sort of
> bug? I use Oracle 8.1.6.0. Thanks.

> --------------------------------------------------------------------

> SQLException information

> Exception 1
>   Message        :ORA-00928: missing SELECT keyword
>   SQLState       :42000
>   SQL Error code :928
> Exception 2
>   Message        :ORA-00928: missing SELECT keyword
>   SQLState       :42000
>   SQL Error code :928
> Statement
>   ID             : 1187
>   Interruptible? : NO
>   Last   SQL     :

> CREATE TABLE TTMMPP_517909_95 TABLESPACE MART_DATA NOLOGGING PARALLEL
> 1 PCTFREE 0 PCTUSED 40 AS SELECT
>         NVL(DimRow0,NULL) DimRow0,
>         NVL(DimColumn0,NULL) DimColumn0,
>          NVL((COUNT( DISTINCT CASE WHEN F0_DCNT_1 <> 0 THEN F0_DCNT_1_C ELSE
> NULL END)),(0)) F0_DCNT_1,
>         0 g0,
>         0 g1

>  FROM (
>  SELECT /*+use_hash(T0,T1,T2)*/
>         NVL(T1.Business_Type,NULL) DimRow0,
>         NVL(T1.Account_Status,NULL) DimColumn0,
>          /*COUNT DISTINCT T1.Account_Number BOOK*/ (SUM (DECODE((
> T0.transtype_key ),( 1 ),( 1) , (NULL) ))) F0_DCNT_1,
>         T1.Account_Number F0_DCNT_1_C
>  FROM
>         CALL_0_A        T0,
>         CUSTOMER_0_B T1,
>         DATE_0 T2
>  WHERE
>         T0.group_key = T1.customer_key
>         AND T0.date_key = T2.date_key
>         AND (T2.cy_name IN ('2001'))
>         AND T0.transtype_key IN (1)
>  GROUP BY
>         T1.Business_Type,
>         T1.Account_Status,
>         T1.Account_Number
> HAVING  SUM(T0.Existence) <> 0
>  ) T  GROUP BY
>         DimRow0,
>         DimColumn0


 
 
 

Strange error - ORA-00928: missing SELECT keyword

Post by Da » Sun, 19 Aug 2001 00:05:32


Carl,

Thanks for the reply. Yes, the syntax is right. I tried just taking
out "AND T0.date_key = T2.date_key" from the WHERE clause, and it
worked. In fact, I tried different SQL with the same tables, as long
as I didn't include any column other than customer_key from my
CUSTOMER_0_B (T1) table in WHERE clause, it seemed fine.

Dan


> Is the following valid syntax?
> DISTINCT CASE WHEN F0_DCNT_1 <> 0 THEN F0_DCNT_1_C ELSE
> NULL END)),(0)) F0_DCNT_1,


> > I got the following error saying missing SELECT. But it has select and
> > the SQL seems OK with me. What could be wrong? Is this some sort of
> > bug? I use Oracle 8.1.6.0. Thanks.

> > --------------------------------------------------------------------

> > SQLException information

> > Exception 1
> >   Message        :ORA-00928: missing SELECT keyword
> >   SQLState       :42000
> >   SQL Error code :928
> > Exception 2
> >   Message        :ORA-00928: missing SELECT keyword
> >   SQLState       :42000
> >   SQL Error code :928
> > Statement
> >   ID             : 1187
> >   Interruptible? : NO
> >   Last   SQL     :

> > CREATE TABLE TTMMPP_517909_95 TABLESPACE MART_DATA NOLOGGING PARALLEL
> > 1 PCTFREE 0 PCTUSED 40 AS SELECT
> >         NVL(DimRow0,NULL) DimRow0,
> >         NVL(DimColumn0,NULL) DimColumn0,
> >          NVL((COUNT( DISTINCT CASE WHEN F0_DCNT_1 <> 0 THEN F0_DCNT_1_C ELSE
> > NULL END)),(0)) F0_DCNT_1,
> >         0 g0,
> >         0 g1

> >  FROM (
> >  SELECT /*+use_hash(T0,T1,T2)*/
> >         NVL(T1.Business_Type,NULL) DimRow0,
> >         NVL(T1.Account_Status,NULL) DimColumn0,
> >          /*COUNT DISTINCT T1.Account_Number BOOK*/ (SUM (DECODE((
> > T0.transtype_key ),( 1 ),( 1) , (NULL) ))) F0_DCNT_1,
> >         T1.Account_Number F0_DCNT_1_C
> >  FROM
> >         CALL_0_A        T0,
> >         CUSTOMER_0_B T1,
> >         DATE_0 T2
> >  WHERE
> >         T0.group_key = T1.customer_key
> >         AND T0.date_key = T2.date_key
> >         AND (T2.cy_name IN ('2001'))
> >         AND T0.transtype_key IN (1)
> >  GROUP BY
> >         T1.Business_Type,
> >         T1.Account_Status,
> >         T1.Account_Number
> > HAVING  SUM(T0.Existence) <> 0
> >  ) T  GROUP BY
> >         DimRow0,
> >         DimColumn0

 
 
 

1. Prepared statement and null values - ORA-00928

I am INSERTING data into Oralce database table using Prepared
statement.  There are three variables (?) in the original prepared
statement which are set using setXXX methods.  However, depending up
on the type of data, an integer column of the database may not have
any value (i.e. setInt(null)) but this fails.

My code is like this:

Preparedstatement prestmt = Connection......

String sqlquery = "INSERT INTO TABLEA VALUES (?,?,?);
// ? 1: Integer column
//? 2: String column
// ? 3: String column

04. boolean ISUser = getUserStatus(Username);
05. if(ISUser)
06. {
07. prestmt.setInt(1, 101);
08. prestmt.setString(2, "Hello");
09. prestmt.setString(3, nulll);
10. }
11. else
12. {
13. prestmt.setInt(1, null);
14. prestmt.setString(2, "Hello");
15. prestmt.setString(3, nulll);

However, when running the program, Line 13 throws exception
java.sql.SQLException: ORA-00928 missing SELECT keyword.

My questions
(a) There is no select statment so oracle error is misleading - is
this the case?
(b) How do I cater for two different possibilities of setting values
in the prepared statement when null values for integer column are
encountered?

I want to avoid writing two sets of prepared statement and then call
appropirate prestmt depending upon ISUser flag, if possible.  This is
because there are 100s of rows and I am creating a batch of all
preparedstatements and then want to update all rows in one go.  If I
write two sets of prestmt then there will be two different batches and
two database calls from the programmed.

Any help will be appreciated.

Regards

crp4

2. Software beta testers required

3. Oracle Error Using BarTender Tool. ORA-00928. Why?

4. Isql & ksh -> use database

5. Strange Oracle error: ORA-06502 (and Microsoft run-time error -2147467259(80004005))

6. FoxPro 2.6 fonts in FPW

7. Gettting user input in a stored procedure to send email message

8. ORA-00936: Missing Expression Error

9. ORA-00931: missing identifier error when using DBMS_UTILITY.COMMA_TO_TABLE

10. OUTLN Schema Missing Error (ORA - 18008)

11. SQL*Net ORA errors missing text

12. ORA-00936: Missing Expression Error