Subject | Re: Execute Statement eating memory |
---|---|
Author | pi3k14 |
Post date | 2006-01-13T08:11:51Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
Thank you for your time and effort in helping me with this case, but
could you please elaborate a bit more on my questions below ?
reference for Firebird?), the valid syntax for a select is like this:
SELECT [TRANSACTION transaction]
[DISTINCT | ALL]
{* | <val> [, <val> ]}
[INTO :var [, :var ]]
FROM <tableref> [, <tableref> ]
[WHERE <search_condition>]
[GROUP BY col [COLLATE collation] [, col [COLLATE collation] ]
<tableref> = <joined_table> | table | view | procedure
[(<val> [, <val> ])] [alias]
<val> = {
col [<array_dim>] | :variable
| <constant> | <expr> | <function>
| udf ([<val> [, <val> ]])
| NULL | USER | RDB$DB_KEY | ?
} [COLLATE collation] [AS alias]
Nothing here preventing the argument to a select procedure from being
a column.
My procedure does as SELECT COUNT(*) FROM Bunke in this query, so it
has to know about the table.
EXISTS have to be evaluated for each record in the SELECT, thereby I
had the impression that using a column from the main query was no
problem (and the reference doesn't prohibit it).
I have a similar singleton query in the same procedure that does work.
behave like at table, is it not?
Re. correlation, all identifiers are unique so aliases should not be
necessary (but I will give it a try and see what happens).
frode
wrote:
>blabla'
> At 01:00 PM 12/01/2006 +0000, you wrote:
> >--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...
>
> >wrote:
> > >
> > > At 01:05 PM 11/01/2006 +0000, you wrote:
> > > >Hi,
> > > >I have some code like EXECUTE STATEMENT 'EXECUTE PROCEDURE
> > > >is
> > > >While running this my pagefile grows until available disk space
> > > >exhausted.this
> > > >
> >
> > >
> > > You're running what's sometimes known as "a runaway query" - in
> >case,Show
> > > the procedure logic is probably executing an infinite loop.
> >thecomment
> > > actual code of the two procedures so that it's possible to
> >on whatBilag =
> > > the procedure is *actually* doing, rather than what you think it
> >ought to do...
> > >
> >
> >I have nailed down the cause for this, it is the following select
> >(performed in a procedure)
> > SELECT COUNT(*)
> > FROM Bunke
> > WHERE Aar = :Aar AND Bilagsserie = :Bilagsserie AND :
> >BilagBunke.Id
> > AND Motpartkategori IS NOT NULL
> > AND ( Konto = :Konto AND Dato = :Dato AND Linje < :
> >Bunkelinje )
> > AND EXISTS( SELECT *
> > FROM HentDimSaldoBalanse( 'B',
> > )it
> > WHERE Dimensjoner = :Dimensjoner )
> > INTO Reskontrolinje;
> >
> >It is the EXISTS statement that "breaks the server", it seems like
> >consumes a lot of memory for each invocation.the
> >HentDimSaldoBalanse is simplified to just return the string '#'.
> >
> >When inserting an Exception statement just after this select I got
> >message "No current record for fetch operation" before my exceptionthere's
> >info was output (Using IBObjects).
> >When this statement is run from IBOConsole no errors are reported
> >
> >Is there anything obvious wrong with what I am doing?
>
> Yes. Even if this approach made any sense (which it doesn't!),
> quite a lot of illegal or impossible SQL in both these fragments ofcode
> that you have divulged here.<..last fragment removed..>
Thank you for your time and effort in helping me with this case, but
could you please elaborate a bit more on my questions below ?
>or else
> The second argument in the select procedure call in the subquery is
> illegal. The value for a procedure argument has to be a constant,
> a colon-prefixed variable or a parenthesised expression resolving toa
> constant of the right type. Bunke.Id is none of these things. It'sa
> reference to a table that only *you* know about. The proceduredoesn't
> know anything about any row or column in Bunke.According to the Interbase language reference (which is also the
reference for Firebird?), the valid syntax for a select is like this:
SELECT [TRANSACTION transaction]
[DISTINCT | ALL]
{* | <val> [, <val> ]}
[INTO :var [, :var ]]
FROM <tableref> [, <tableref> ]
[WHERE <search_condition>]
[GROUP BY col [COLLATE collation] [, col [COLLATE collation] ]
<tableref> = <joined_table> | table | view | procedure
[(<val> [, <val> ])] [alias]
<val> = {
col [<array_dim>] | :variable
| <constant> | <expr> | <function>
| udf ([<val> [, <val> ]])
| NULL | USER | RDB$DB_KEY | ?
} [COLLATE collation] [AS alias]
Nothing here preventing the argument to a select procedure from being
a column.
My procedure does as SELECT COUNT(*) FROM Bunke in this query, so it
has to know about the table.
EXISTS have to be evaluated for each record in the SELECT, thereby I
had the impression that using a column from the main query was no
problem (and the reference doesn't prohibit it).
I have a similar singleton query in the same procedure that does work.
> Next, if it was reasonable to attempt to subquery the output of asome
> selectable stored procedure (which it's not), the syntax is missing
> important elements, notably identifiers or aliases that would enableWhy is it not? The point of a selectable procedure is to make it
> correlation.
>
behave like at table, is it not?
Re. correlation, all identifiers are unique so aliases should not be
necessary (but I will give it a try and see what happens).
frode