ASP Snippets



Free Alerts

Your email will always be
private and will not be shared.

Follow us on twitter.

Zoom In | Zoom Out

Author is awarded Most Valuable Professional award by Microsoft ASP/ASP.Net

Exception - ORA-01036: illegal variable name/number

Author:Mudassar Khan

Server Error in '/' Application.

ORA-01036: illegal variable name/number

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OracleClient.OracleException: ORA-01036: illegal variable name/number



This error occurs when the parameters are not properly passed to the SQLDatasource or Command object when connecting to Oracle Database using System.Data.OracleClient.



The solution to this problem is to correctly pass the parameters Consider the following Query

SELECT * FROM Customers WHERE Cname = :pCname


As you can see above the parameter in Oracle has a prefix : (colon) and not @ like SQL Server Query

When using parameters in query they must start with colon and when adding them they should be added without colon

SelectCommand.Parameters.Add("pCname", OracleType.VarChar, 80).Value="Smith";


Same applies to SQLDatasource

SelectCommand="SELECT * FROM Customers WHERE Cname = :pCname"


    <asp:Parameter Name = "pCname"/>



The links below will give some additional information


If anyone got other solutions please share

Posted: May 21 2009, 20:48 by Mudassar Khan | Comments (0) RSS comment feed |
Views: 7964
Page copy protected against web site content infringement by Copyscape

If you like this article, help us grow by bookmarking this page on any social bookmarking site.
Bookmark and Share


Community News

Web Hosting SpotLight


For consulting and work related queries click here.


Advertise with us. For more details click here.


Please provide your valuable suggesstions here.

This Site is hosted on Web Hosting