Tuesday, June 15, 2021

[VB.net][Resolved] DataAccess.Client.OracleException ORA-00911 invalid character

Error message:

DataAccess.Client.OracleException ORA-00911 invalid character


Source:

Dim oradb As String = "Data Source=127.0.0.1/CLP;User Id=user;password=password"

com = New OracleConnection(oradb)


Dim cmd As New OrcaleCommand

cmd.Connection = conn

cmd.CommandText = "SELECT COUNT(*) AS amount FROM batches WHERE batch_no LIKE '20200713%';"


Dim dr As OracleDataReader = cmd.ExecuteReader()

dr.Read()


Solution:

sql syntax error, for my case is remove the semi-colon from the end of sql:

change 

cmd.CommandText = "SELECT COUNT(*) AS amount FROM batches WHERE batch_no LIKE '20200713%';"

to 

cmd.CommandText = "SELECT COUNT(*) AS amount FROM batches WHERE batch_no LIKE '20200713%'"


Reference: 

https://stackoverflow.com/questions/12262145/ora-00911-invalid-character/18456333


No comments :

Post a Comment