Click to See Complete Forum and Search --> : Oracle: ADO & RDO Error


lauris
July 28th, 1999, 02:59 PM
I have a query like this:

SELECT activosFIT.CodigoAFIT,TipoAFIT,StatusAFIT,DescripcionAFIT,MarcaAFIT,ModeloAFIT,SerialAFIT,nombrepr,propietario,ACTIVOSFIT.ObservacionesAFIT,eactual,eminima,emaxima,mantenimiento

FROM ActivosFIT,Proveedores WHERE ActivosFIT.CodigoPR = Proveedores.CodigoPR(+) AND ActivosFIT.CodigoAFIT like '%' AND DescripcionAFIT <> 'TEMP' AND
(UPPER(DescripcionAFIT) like '%' OR DescripcionAFIT IS NULL) AND (UPPER(MarcaAFIT) like '%' OR MarcaAFIT IS NULL) AND (UPPER(ModeloAFIT) like '%' OR ModeloAFIT IS NULL)
AND (UPPER(SerialAFIT) like '%' OR SerialAFIT IS NULL) AND (UPPER(Propietario) like '%' OR PROPIETARIO IS NULL) AND (UPPER(ACTIVOSFIT.ObservacionesAFIT) like '%' OR
ObservacionesAFIT IS NULL) AND (UPPER(NombrePR) LIKE '%' OR NOMBREPR IS NULL) AND (EActual LIKE '%' OR EACTUAL IS NULL) AND (EMinima LIKE '%' OR EMINIMA IS
NULL) AND (EMaxima LIKE '%' OR EMAXIMA IS NULL) AND (Mantenimiento LIKE '%Meses' OR MANTENIMIENTO LIKE '%Aņos' OR MANTENIMIENTO IS NULL) and TipoAFIT like
'FIJO' AND (StatusAFIT like 'DISPONIBLE') ORDER BY ACTIVOSFIT.CodigoAFIT ASC

Ok!, my situation is:
I'm developing a client-server application using VB6 and ORACLE, prevously I was using DAO and ODBC as the connection method, everything worked fine but, I discovered that there were better
methods to access databases like RDO or ADO...

Whatever, now the point is that when I use those new methods to retreive the records from the server (using the SQL written above) VB6 gives me an error...

I'm sure that the error is due to SQL lenght and not due to the relations or the SQL statement as itself, because:

1. When I wrote the SQL directly into the server, it executed without error, the problem is when I try to perform the same query from the client...

2. When I tried with a SQL shorter then 80 words, the results were fine and there was no problem at all...

PLEASE HEEELLLPPP!!!! :(

Moor
August 2nd, 1999, 11:07 PM
Hi lauris,

The error may be due to quotes in the SQL. RDO takes queries of this length.
U can try the following.

Dim strSql as String

strSql = "SELECT ... " 'Part of ur SQL
strSql = strSql & "part of ur SQL "
.
.
.

rdoRs = rdoCon.OpenResultset(strSql,...)

TRy this out

Ganesh Bala
August 3rd, 1999, 12:36 PM
You can use alias for the tablenames like
<FROM ActivosFIT A, Proveedores P>
so your statement LENGTH will be less.
Also I am noticing conditions like
***
UPPER(DescripcionAFIT) like '%' OR DescripcionAFIT IS NULL)
AND (UPPER(MarcaAFIT) like '%' OR MarcaAFIT IS NULL)
***
These conditions imply that you want records where
<Field> has some value or <Field> is null. What do you mean by that.
It will fetch all the records anyway.

You can remove redundant conditions like this.