I am getting below error while executing a select statement on vb.net for oracle. I am trying to pass account number as a parameter to the select statement . Below is the SQL statement
Dim strSearchSQL As String
strSearchSQL = "SELECT A.ACCT_GRP_CD, A.AVG_METH_CD , B.AVG_METH_DSCR, A.ACCT_GRP_DSCR, A.COST_POOL_CD, A.ABC_MULT_NUM, A.INTRM_METH_CD, A.RATE_POOL_RPT_CD FROM GL_ACCT_GRP_TB A, GL_AVG_METH_TB B WHERE A.AVG_METH_CD = B.AVG_METH_CD"
If Not AccountGroup = "" Then
strSearchSQL = strSearchSQL & " AND ACCT_GRP_CD LIKE '%{: AccountGroup}%' "
End If
If Not OrderBy = "" And Not OrderAs = "" Then
strSearchSQL = strSearchSQL & " ORDER BY " & OrderBy & " " & OrderAs
Else
strSearchSQL = strSearchSQL & " ORDER BY ACCT_GRP_CD XYZ "
End If
Dim cmd As New OracleCommand
cmd.CommandText = strSearchSQL
cmd.CommandType = CommandType.Text
cmd.Connection = Connection.GetConnection
cmd.Parameters.Clear()
Dim Param1 As OracleParameter = New OracleParameter("AccountGroup", OracleType.Char, 500)
Param1.Direction = ParameterDirection.Input
Param1.Value = AccountGroup.Trim
cmd.Parameters.Add(Param1)
and Below is the error that I am getting
Error : ORA-01036: illegal variable name/number
Please help me to identify where exactly I am making mistake