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
    Posts
    7

    Re: ORA-00936 missing expression error

    Sorry for posting this twice...

  3. #3
    Join Date
    Sep 2003
    Posts
    1

    Re: ORA-00936 missing expression error

    Looks like one of the params you're passing in may be NULL. Make sure gstrFromDate, gstrToDate and fnWhereClause really contain valid-looking values before sending this SQL to the db.

    Also, it looks like you're just passing a string to the db, so you'll probably need to wrap your params in single-quotes or you'll likely get a ORA-00904: invalid expression error.

    Also, since you're passing fnWhereClause to a SQL IN clause then you'll need to make sure it's wrapped in parens.



    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

Posting Permissions

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