|
-
Feb 27th, 2007, 12:10 PM
#1
Thread Starter
Fanatic Member
What's wrong with this SQL statement?
I use Oracle 10g with Client9
In SQL Navigator this works:
Code:
SELECT (SELECT Count(*) from tbllev) totalrows, salesorder, customer, idt FROM tblLev
But when I use exactly same SQL from VB it doesen't work?
vb Code:
SQL = "SELECT (SELECT Count(*) from tblLev) totalrows, salesorder, customer, idt FROM tblLev"
I get error "ORA-00936: missing expression"
If I remove this from the SQL string: (SELECT Count(*) from tblLev) totalrows, it works from VB?
Last edited by Pirre001; Feb 27th, 2007 at 12:19 PM.
-
Feb 27th, 2007, 12:47 PM
#2
Re: What's wrong with this SQL statement?
I'm not sure, but aren't you missing a comma?
"SELECT (SELECT Count(*) from tblLev), totalrows, salesorder, customer, idt FROM tblLev"
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Feb 27th, 2007, 01:32 PM
#3
Re: What's wrong with this SQL statement?
Nooooo, he's not missing a coma.... that's the field alias for the SELECT....
Squeeze an "AS" between the ")" and "totalrows" ....
Double check your connection string and make sure you are using an Oracle provider and not a generic ODBC provider.
-tg
-
Feb 27th, 2007, 02:31 PM
#4
Thread Starter
Fanatic Member
Re: What's wrong with this SQL statement?
I've checked again and found that the oracle provider I use "Provider=OraOLEDB.Oracle" is not working with this kind of query.
If I change provider to Microsofts "Provider=msdaora" it works?
Can some one tell me why it is so?
-
Feb 27th, 2007, 09:02 PM
#5
Re: What's wrong with this SQL statement?
It's something that was implemented in one provider that wasn't done in the other. For anything more complete than that, you'd have to talk to those who wrote the providers.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|