Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Any suggestions ?

Re: Any suggestions ?

From: Luc Gyselinck <Luc.Gyselinck_at_nospampandora.be>
Date: Fri, 14 Jan 2005 22:49:28 GMT
Message-ID: <Y%XFd.31119$9v5.2833549@phobos.telenet-ops.be>


This is not an ORA error, is it ? VB compilation error ?

Try this one...

strSQL = "select * from ""Cottages"", ""Pricebands""" & _

" where ""Location"" = '" & strLocation & "'" & _
" and ""Price Number"" = '" & strDates & "'" & _
" and ""Bedrooms Number"" = '" & strRooms & "'" & _
" and ""Pets"" = '" & strPets & "'"

To test it, I created a small file x.vbs

C:\>type x.vbs

strSQL = "select * from ""Cottages"", ""Pricebands""" & _

" where ""Location"" = '" & strLocation & "'" & _
" and ""Price Number"" = '" & strDates & "'" & _
" and ""Bedrooms Number"" = '" & strRooms & "'" & _
" and ""Pets"" = '" & strPets & "'"

wscript.Echo strSQL

Now I run cscript to see if my sintax is ok

C:\>cscript x.vbs
Microsoft (R) Windows Script Host Version 5.1 for Windows Copyright (C) Microsoft Corporation 1996-1999. All rights reserved.

select * from "Cottages", "Pricebands" where "Location" = '' and "Price Number"
= '' and "Bedrooms Number" = '' and "Pets" = ''

C:\>

Because the other variables were not declared nor initiliazed, there is nothing between the single quotes. But this looks like a valid SQL statement...

"Mike" <mike.walton_at_btinternet.com> wrote in message news:BJXFd.1274$TT5.127_at_newsfe6-gui.ntli.net...
> Luc
>
> Many many thanks for your very quick reply.......appreciated. I have
> tried your statement but now get the following response :
>
> Expected end of statement
>
>
> strSQL = "select * from "Cottages", "Pricebands" where "Location" = '&
> strLocation &' and "Price Number" = '& strDates &' and "Bedrooms
> Number" = '& strRooms &' and "Pets" = '& strPets &'"
>
> Any quick solution ? any chance I could email you the page for you to
> look at in context ??
>
> Many thanks
>
> Luc Gyselinck wrote:
>
> > If you would take the time to elaborate this expression, it would
> > look like:
> >
> > select * from Cottages, Pricebands where Location = '<something>',
> > Price Number = '<something>', Bedrooms Number = '<something>', Pets =
> > '<something>'
> >
> > You have several problems here
> > 1. This is not a valid SQL statement, hence the ORA-00933 error
> > 2. You do not use bind variables, you will blow up your sql area
> > 3. There is no join condition between the two tables you select from,
> > cartesian product, is this the intend ?
> > 4. Are your table and column names case sensitive? If yes, you'll
> > have to put the names between double quotes.
> > 5. What about these columns in two words ? Price Number, etc...
> >
> > Give us a describe of the tables...
> >
> > SQL> select * from Cottages, Pricebands where Location =
> > '<something>', 2 Price Number = '<something>', Bedrooms Number =
> > '<something>', Pets = '<something>'
> > SQL> /
> > select * from Cottages, Pricebands where Location = '<something>',
> > *
> > ERROR at line 1:
> > ORA-00933: SQL command not properly ended
> >
> > SQL> create table test
> > 2 ( "Price Number" number,
> > 3 "Bedrooms Number" number)
> > 4 /
> >
> > Table created.
> >
> > SQL> descr test
> > Name Null? Type
> > ----------------------------------------- --------
> > ------------------------ ----
> > Price Number NUMBER
> > Bedrooms Number NUMBER
> >
> > SQL> insert into test values(1,1);
> >
> > 1 row created.
> >
> > SQL> commit;
> >
> > Commit complete.
> >
> > SQL> select Price Number from test
> > 2 /
> > select Price Number from test
> > *
> > ERROR at line 1:
> > ORA-00923: FROM keyword not found where expected
> >
> > SQL> select "Price Number" from test
> > 2 /
> >
> > Price Number
> > ------------
> > 1
> >
> > SQL> drop table test
> > 2 /
> >
> > Table dropped.
> >
> > SQL>
> >
> > Here is something that looks closer to SQL:
> >
> > select * from "Cottages", "Pricebands" where "Location" =
> > '<something>' AND "Price Number" = '<something>' AND "Bedrooms
> > Number" = '<something>' AND "Pets" = '<something>'
> >
> > Good luck.
> >
> > "Mike" <mike.walton_at_btinternet.com> wrote in message
> > news:x3XFd.543$N25.236_at_newsfe3-gui.ntli.net...
> > > Anybody able to advise please
> > >
> > > I get the following message
> > > ORA-00933: SQL command not properly ended
> > >
> > > which relates to the following statement
> > >
> > > strSQL = "select * from Cottages, Pricebands where Location = '"&
> > > strLocation &"', Price Number = '"& strDates &"', Bedrooms Number =
> > > '"& strRooms &"', Pets = '"& strPets &"' "
> > >
> > > What's wrong ??
>
Received on Fri Jan 14 2005 - 16:49:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US