ASP 1.1 ORA-00911: invalid character

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cathode Follower
    New Member
    • Feb 2008
    • 5

    ASP 1.1 ORA-00911: invalid character

    This may seem obvious, but I spent a while before I spotted it, so it might help others.
    If you use a select statement with a semicolon at the end of the string e.g.
    SELECT * FROM PEOPLE;
    with Oracle then it will give the above error. Exactly the same statement works correctly with SQL Server.
  • idsanjeev
    New Member
    • Oct 2007
    • 241

    #2
    Hi Cathode Follower
    Where are you written this code.
    This code is only excute on sql
    If you are written on asp you have to open connection first then write select statement for displaying
    [CODE=asp]
    <%
    dim objconn
    Set objconn = Server.CreateOb ject("ADODB.Con nection")
    objconn.Open "DSN=ORACLE;Use r Id=userid;Passw ord=password;"
    set objRS=server.cr eateobject("ADO DB.Recordset")
    Set objRs = objConn.Execute ("SELECT *FROM people")

    Response.Write "<table border=1 cellpadding=4>"
    Response.Write "<tr>"

    For I = 0 To objRS.Fields.Co unt - 1
    Response.Write "<td><b>" & objRS(I).Name & "</b></td>"
    Next

    Response.Write "</tr>"

    Do While Not objRS.EOF
    Response.Write "<tr>"

    For I = 0 To objRS.Fields.Co unt - 1
    Response.Write "<td>" & objRS(I) & "</td>"
    Next

    Response.Write "</tr>"

    objRS.MoveNext
    Loop

    Response.Write "</table>"

    objRs.Close
    objConn.Close
    End If
    %>

    [/CODE]

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      Originally posted by Cathode Follower
      This may seem obvious, but I spent a while before I spotted it, so it might help others.
      If you use a select statement with a semicolon at the end of the string e.g.
      SELECT * FROM PEOPLE;
      with Oracle then it will give the above error. Exactly the same statement works correctly with SQL Server.
      Thanks for that. I've never used Oracle from ASP before, didn't realize that was a problem. Since the semi-colon is actually required (per SQL standards, and Oracle uses it) but MS SQL server doesn't require it, it makes sense that ASP probably adds the semi-colon when connected to Oracle, but not when connected to SQL server, hence the problem is probably redundancy. Anyway, thanks for posting it.

      Jared

      Comment

      Working...