Link to home
Start Free TrialLog in
Avatar of Rougie
Rougie

asked on

SQL/Oracle/invalid column name

I'm trying to pull some data drom an Oracle database and it woeks fine with:

       iCode = "00001"    
 
      Dim strSQL

      strSQL = "Select * FROM PPI.PPT_CLASS_TABLE_QCLA WHERE CLASS_CD = '00001'"



But when I try the following I get the error message pasted below.

       iCode = "00001"    
 
      Dim strSQL


     strSQL = "Select * FROM PPI.PPT_CLASS_TABLE_QCLA WHERE CLASS_CD = iCode"


Here is the error message I get:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC driver for Oracle][Oracle]ORA-00904: invalid column name


Anyone have any idea what I'm doing wrong?
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
iCode is a variable name and not a field name. Thus you got to separate it from the "..."

hongjun
Avatar of Rougie
Rougie

ASKER

That works much better! Thanks!!!