473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

invalid column name in SQL query

1
I am trying to execute following query but i am getting a sql exception
i do not understand where i went wrong. it is saying invalid column name but i have given all fields and table names correctly, please help me out.

java.sql.SQLException: ORA-00904: invalid column name


Expand|Select|Wrap|Line Numbers
  1.  rs=st.executeQuery("SELECT EP.EMP_ID,EP.EMP_PASS,EC.CNAME,EC.MEMAIL,EC.TYPE,EC.CPERSON,EC.DESIG,EC.WURL,EC.EADDR,EC.ECITY,EC.ESTATE,EC.EZIPCODE,EC.ECOUNTRY,EC.EMBNO,EC.PHNO,EC.FAXNO FROM EMP_LOGIN EP,EMP_COMPANY_DETAILS EC WHERE (EP.EMP_ID='"+this.empid+"'AND EP.EMP_PASS='"+this.epwd+"'AND EP.EMP_ID=EC.EMP_ID)");
if any one knows solutuion. please mail me at xxxxxxxx@xxxxxxxx.xxx

thank you
Aug 3 '07 #1
3 5353
JosAH
11,448 Expert 8TB
Sorry, no email addresses allowed as per the posting guidelines.

The SQL parser isn't wrong: you're definitely passing an incorrect column name
in that query. Not knowing what the correct names are I can't help you out any
further; you have to meticulously check every single column name and check
whether or not you have inserted spaces and/or commas at the right places as well.

kind regards,

Jos
Aug 3 '07 #2
praveen2gupta
201 100+
I am trying to execute following query but i am getting a sql exception
i do not understand where i went wrong. it is saying invalid column name but i have given all fields and table names correctly, please help me out.

java.sql.SQLException: ORA-00904: invalid column name


Expand|Select|Wrap|Line Numbers
  1.  rs=st.executeQuery("SELECT EP.EMP_ID,EP.EMP_PASS,EC.CNAME,EC.MEMAIL,EC.TYPE,EC.CPERSON,EC.DESIG,EC.WURL,EC.EADDR,EC.ECITY,EC.ESTATE,EC.EZIPCODE,EC.ECOUNTRY,EC.EMBNO,EC.PHNO,EC.FAXNO FROM EMP_LOGIN EP,EMP_COMPANY_DETAILS EC WHERE (EP.EMP_ID='"+this.empid+"'AND EP.EMP_PASS='"+this.epwd+"'AND EP.EMP_ID=EC.EMP_ID)");
if any one knows solutuion. please mail me at xxxxxxxx@xxxxxxxx.xxx

thank you

Hi

I am not able to understand why you are using this keyword. This keyword will not work here. Remove it and test. If still there is error then post complete code.
Aug 3 '07 #3
JosAH
11,448 Expert 8TB
Hi

I am not able to understand why you are using this keyword. This keyword will not work here. Remove it and test. If still there is error then post complete code.
It might work if 'epwd' and 'empid' are members of the object itself. The 'this'
reference would be redundant but it would work fine.

kind regards,

Jos
Aug 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: chelleybabyger | last post by:
Using the below method, <% remaining_stock = cint(product_stock) - cint(chQuantity) %> <% sqlString = "UPDATE Products SET " &_ "product_stock='" & remaining_stock & "'," &_ "WHERE...
8
by: Shino | last post by:
Hi, Can anyone help with this error: "ORA-00904: invalid column name"? Thanks! SQL> create view PPFa as 2 SELECT L.UserID AS LecID, U.Name, U.Email, I.IntakeID, S.UserID AS StudID 3 FROM...
1
by: wiredog | last post by:
When I try to add the line . . . CPM * MOU AS COST, after all the CASE lines I get the response in SQL Query Analyser, Server: Msg 207, Level 16, State 3, Line 1 Invalid column name 'CPM'....
4
by: rawheiser | last post by:
Behavior I found: Invalid Column name in select embedded in a IN() clause appears to return a NULL, and fails silently - completing the query giving incorrect results. Behavior I expected: ...
8
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
15
by: David | last post by:
Hi, I have built a web application that will be a very high profile application. We had tested it, demonstrated it and shown that it all works. On a dress rehearsal run through, it failed...
3
by: graphicsxp | last post by:
Hi, I have a SQL stored procedure which looks like that: SELECT @QuerySQL = 'SELECT as LookupField, G.GroupDesc + ' + '" : "' + ' + as DescField FROM ' + 'JOIN ItemGrouping IG on IG.CatID...
5
by: sweetpotatop | last post by:
Hi, I got 'Invalid Column Name NewCol1' when I query the following: Select col1, col2, (some calculation from the fields) as NewCol1, (some calculation from the fields) as NewCol2, NewCol1 =...
5
by: Anne | last post by:
Hello! Here is the statement in question: --STATEMENT A SELECT * FROM dbo.myTable WHERE colX in (SELECT colX FROM dbo.sourceTable) The problem with Statement A is that 'colX' does not exist...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.