Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    7

    Unanswered: ORA-00936 missing expression error

    Hi all...

    I'm somewhat new to SQL and as part of my new job need to add to a VB program that interfaces with a database using SQL calls.

    I pretty much followed the structure for existing calls, but am getting the following error:

    ORA-00936: missing expression

    This is what the code looks like:

    strSql = "SELECT TIME,"
    strSql = strSql & " SYMBOL,"
    strSql = strSql & " ID,"
    strSql = strSql & " CODE,"
    strSql = strSql & " TYPE_CODE,"
    strSql = strSql & " SIDE,"
    strSql = strSql & " VOL,"
    strSql = strSql & " FROM MS"
    strSql = strSql & " WHERE TYPE_CODE = 'X'"
    strSql = strSql & " AND DATE >= TO_DATE(" & gstrFromDate & ",'YYYYMMDD') "
    strSql = strSql & " AND DATE <= TO_DATE(" & gstrToDate & ",'YYYYMMDD')"
    strSql = strSql & " AND CODE IN " & fnWhereClause

    Any ideas?

    Thanks in advance...

    KJ

  2. #2
    Join Date
    Sep 2003
    Location
    The Netherlands
    Posts
    311

    Re: ORA-00936 missing expression error

    Originally posted by kj_one
    Hi all...

    I'm somewhat new to SQL and as part of my new job need to add to a VB program that interfaces with a database using SQL calls.

    I pretty much followed the structure for existing calls, but am getting the following error:

    ORA-00936: missing expression

    This is what the code looks like:

    strSql = "SELECT TIME,"
    strSql = strSql & " SYMBOL,"
    strSql = strSql & " ID,"
    strSql = strSql & " CODE,"
    strSql = strSql & " TYPE_CODE,"
    strSql = strSql & " SIDE,"
    strSql = strSql & " VOL,"
    strSql = strSql & " FROM MS"
    strSql = strSql & " WHERE TYPE_CODE = 'X'"
    strSql = strSql & " AND DATE >= TO_DATE(" & gstrFromDate & ",'YYYYMMDD') "
    strSql = strSql & " AND DATE <= TO_DATE(" & gstrToDate & ",'YYYYMMDD')"
    strSql = strSql & " AND CODE IN " & fnWhereClause

    Any ideas?

    Thanks in advance...

    KJ
    Hi,

    Your problem is in the line :
    **strSql = strSql & " VOL,"
    should be
    strSql = strSql & " VOL"

    Because of the ',' after VOL, oracle expects another column name

    Hope this helps
    Edwin van Hattem
    OCP DBA / System analyst

  3. #3
    Join Date
    Sep 2003
    Posts
    7
    Can't believe I didn't spot that...thanks for your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •