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: Mysterious query

Re: Mysterious query

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Tue, 04 Mar 2003 15:30:29 +0000
Message-ID: <b429us$5m0$1@ctb-nnrp2.saix.net>

> -----Original Message-----
> Peter Michelson [mailto:pete77r_at_hotmail.com]

>
> Here's a poser: I have a Delphi 6 Enterprise app using the BDE to
> connect to
> Oracle 8.1.7.3. I've been getting sporadic "Ambiguous Column Name"
> errors
> from Oracle. When I ran SQL Trace it revealed an impossible query:
> somehow, a query which contains all fields from all of my database
> tables was being processed. This query even contains fields from tables
> in the database which aren't being used in the Delphi application.

What Delphi class do you use? TQuery, TTable or something else?

If TQuery, the problem could be with the SQL property that contains the SQL command. The SQL property is a TStringList or TStrings class (former a subclass of the latter). There's a problem with the way that class deals with its properties called, LINES (mutltiple lines with controlfeeds) and TEXT (a single string containing all lines).

The problem arise when you use the Lines property to add a SQL statement. The TQuery class sends the Text property to OCI - which then contains linefeed chars.. which in turns messes Oracle around as that linefeed can be slap bang in the middle of a table name or column name.

If TTable, then you will get _all_ the columns for that table. I recommend not using it as clients should deal with sub sets of data and not whole tables.. i.e. with TQuery and SELECTs.

If you like, throw the .pas unit file (plus the associated .dfm file) with the offending code my way via direct e-mail and I will take a look at the code.

--
Billy
Received on Tue Mar 04 2003 - 09:30:29 CST

Original text of this message

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