Subject | Re: [IBO] possible bug in error message |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-04-30T10:20:09Z |
Ronaldo,
I find your query a bit strange in your linking of
TP_LANCAMENTO_GRUPO_CREDITO to the other tables. In general, it is better
to use JOINs rather than the WHERE clause to link tables (which also avoids
the need for JoinLinks), and your statement would then look like this:
SELECT DISTINCT
C.ID
, I.NOME
, TC.DESCRICAO AS TP_CONTA
, C.DESCRICAO CONTA
FROM INSTITUICAO I
JOIN CONTAS C ON C.INSTITUICAO=I.ID
JOIN INSTITUICAO_GRUPO IG ON IG.INSTITUICAO=I.ID
JOIN TP_LANCAMENTO_GRUPO_CREDITO TLGC ON IG.GRUPO LIKE TLGC.GRUPO||'%'
JOIN TIPO_CONTAS TC ON TC.ID=C.TIPO
WHERE TLGC.TIPO_LANCAMENTO=:TIPO_LANCAMENTO
Now, I've never seen LIKE used within JOINs, and expect it to be illegal.
Note that it isn't the SQL-92 that is possibly making it illegal - it just
makes it easier to spot what is potentially wrong.
Hopefully someone else can tell you if this is possible, or if there is any
other way for you to achieve this.
Set
I find your query a bit strange in your linking of
TP_LANCAMENTO_GRUPO_CREDITO to the other tables. In general, it is better
to use JOINs rather than the WHERE clause to link tables (which also avoids
the need for JoinLinks), and your statement would then look like this:
SELECT DISTINCT
C.ID
, I.NOME
, TC.DESCRICAO AS TP_CONTA
, C.DESCRICAO CONTA
FROM INSTITUICAO I
JOIN CONTAS C ON C.INSTITUICAO=I.ID
JOIN INSTITUICAO_GRUPO IG ON IG.INSTITUICAO=I.ID
JOIN TP_LANCAMENTO_GRUPO_CREDITO TLGC ON IG.GRUPO LIKE TLGC.GRUPO||'%'
JOIN TIPO_CONTAS TC ON TC.ID=C.TIPO
WHERE TLGC.TIPO_LANCAMENTO=:TIPO_LANCAMENTO
Now, I've never seen LIKE used within JOINs, and expect it to be illegal.
Note that it isn't the SQL-92 that is possibly making it illegal - it just
makes it easier to spot what is potentially wrong.
Hopefully someone else can tell you if this is possible, or if there is any
other way for you to achieve this.
Set