Recent

Author Topic: [SOLVED] Error on multiple Selects  (Read 2062 times)

gkelby

  • New Member
  • *
  • Posts: 24
[SOLVED] Error on multiple Selects
« on: January 01, 2015, 02:07:26 am »
I was hoping someone could assist me with this problem.  Not sure what I'm doing wrong.

I issue a Select statement to read from a table with no problem.  I then issue another Select call to the same table to read a different set of columns from the first set and I get an error message telling me the first column to be read in the second set does not exist.  The exact error message is "Debugger Exception Notification: Project xxx raised exception class 'EDatabaseError' with message no such column: Col1, at address xxx" .  And yes, the column it complains about does exist.

I tried closing the transaction and committing the previous read select prior to setting up the new Select statement, but they have had no effect.

Using Lazarus 1.1.99 Pre-Release, FPC Version 2.6.2, SVN Revision 42829 on Win 7 64 bit version.

Thanks for helping.

GK


« Last Edit: January 02, 2015, 01:52:01 am by gkelby »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8109
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Error on multiple Selects
« Reply #1 on: January 01, 2015, 06:04:16 am »
code please...

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Error on multiple Selects
« Reply #2 on: January 01, 2015, 07:47:30 am »
The message does not mean that the column does not exist in you table
means tha is not exist in your select query
ex:
table :[col1][col2][col3][col4][col5]
select * from (select col1,col2 from table);
columns 3/4/5 are not included because you limit your results to 1 and 2 with the first select
if you try to access 3/4/5 you will get the error you mention
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

gkelby

  • New Member
  • *
  • Posts: 24
Re: Error on multiple Selects
« Reply #3 on: January 02, 2015, 01:41:03 am »
Hi Never:

To use your example, I'll expand on what I'm doing:

table :[col1][col2][col3][col4][col5]

The first select, for example, is select col1, col2 from table where "qualifier", and it works.

The second select is, select col3, col4, col5 from table where "qualifier" and at this point the statement errors out with the error message stating that col3 does not exist.

The "qualifier" is the same for both statements.

I can change the second select to read select col4, col5 from table where "qualifier" and, again, the statement errors out with the error message stating that col4 does not exist.

GK.

gkelby

  • New Member
  • *
  • Posts: 24
Re: Error on multiple Selects
« Reply #4 on: January 02, 2015, 01:50:39 am »
Hi Never:

Thanks for responding.  I've found the problem.  I should have taken a MUCH closer look at the text of the select.  The problem was a simple space character between col5 and "From".  In other words, the statement was trying to read from "col5from table" rather that "col5 from table".

Thanks...
Gk.

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Error on multiple Selects
« Reply #5 on: January 02, 2015, 01:55:13 am »
if  the col exist in table
and
if  the col exist in sql
then you missspelling the field name
or inside the sql --> or a typo--->edit and fix
                                or a ***ghost**-->try to use [col2],[col4] etc
or inside the table definition -->edit and fix

if you still have problem upload a small demo to reproduce your issue as @Leledumbo mention
Edit***: Glad you made it
« Last Edit: January 02, 2015, 01:56:53 am by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε