Board index » delphi » not a single-group group function

not a single-group group function

I'm new to D7, having a lot of exp with D1-5.  Using a TADOQuery...
Oracle DB, Win2000.

function Tdm.IsValidLoan(Lnkey: string): boolean;
begin
  with qValidLoan do
  begin

//this is the sql...
//  select count(1) from dblocks where lnkey = :LNKEY

    Parameters.ParamByName('LNKEY').Value:=Lnkey;
    open;

{
---------------------------
De{*word*81} Exception Notification
---------------------------
Project Dropspot.exe raised exception class EOleException with message
'ORA-00937: not a single-group group function'. Process stopped. Use Step or
Run to continue.
---------------------------
OK   Help
---------------------------

Quote
}

    result:=(Fields[0].AsInteger=1);
    close;
  end;
end;
 

Re:not a single-group group function


Hi Bryan,

  if you're recieving an ORA-937,  the SQL statement is not what you think
it is and conains a 'GROUP BY' clause.  Another possibility is that your
underlying table is actually a view with a 'GROUP BY' in it.

Cause: A SELECT list cannot include both a group function, such as AVG,
COUNT,
MAX, MIN, SUM, STDDEV, or VARIANCE, and an individual column expression,
unless
the individual column expression is included in a GROUP BY clause.

Action: Drop either the group function or the individual column expression
from
the SELECT list or add a GROUP BY clause that includes all individual column
expressions listed.

  Are you specifically setting the SQL in the query in your function or do
you rely upon the component to have the statement prior to entering your
function?

Regards,

Michael

Quote
"Bryan Valencia" <br...@209software.com> wrote in message

news:3ef398c1$1@newsgroups.borland.com...
Quote
> I'm new to D7, having a lot of exp with D1-5.  Using a TADOQuery...
> Oracle DB, Win2000.

> function Tdm.IsValidLoan(Lnkey: string): boolean;
> begin
>   with qValidLoan do
>   begin

> //this is the sql...
> //  select count(1) from dblocks where lnkey = :LNKEY

>     Parameters.ParamByName('LNKEY').Value:=Lnkey;
>     open;

> {
> ---------------------------
> De{*word*81} Exception Notification
> ---------------------------
> Project Dropspot.exe raised exception class EOleException with message
> 'ORA-00937: not a single-group group function'. Process stopped. Use Step
or
> Run to continue.
> ---------------------------
> OK   Help
> ---------------------------
> }

>     result:=(Fields[0].AsInteger=1);
>     close;
>   end;
> end;

Re:not a single-group group function


Actually, it works fine when I ask Delphi to insert the parameter in to the
SQL, but not as a parameterized query.

Quote
"Michael Jacobs" <iq...@earthlink.net> wrote in message

news:3ef5951b@newsgroups.borland.com...
Quote
> Hi Bryan,

>   if you're recieving an ORA-937,  the SQL statement is not what you think
> it is and conains a 'GROUP BY' clause.  Another possibility is that your
> underlying table is actually a view with a 'GROUP BY' in it.

> Cause: A SELECT list cannot include both a group function, such as AVG,
> COUNT,
> MAX, MIN, SUM, STDDEV, or VARIANCE, and an individual column expression,
> unless
> the individual column expression is included in a GROUP BY clause.

> Action: Drop either the group function or the individual column expression
> from
> the SELECT list or add a GROUP BY clause that includes all individual
column
> expressions listed.

>   Are you specifically setting the SQL in the query in your function or do
> you rely upon the component to have the statement prior to entering your
> function?

> Regards,

> Michael

> "Bryan Valencia" <br...@209software.com> wrote in message
> news:3ef398c1$1@newsgroups.borland.com...
> > I'm new to D7, having a lot of exp with D1-5.  Using a TADOQuery...
> > Oracle DB, Win2000.

> > function Tdm.IsValidLoan(Lnkey: string): boolean;
> > begin
> >   with qValidLoan do
> >   begin

> > //this is the sql...
> > //  select count(1) from dblocks where lnkey = :LNKEY

> >     Parameters.ParamByName('LNKEY').Value:=Lnkey;
> >     open;

> > {
> > ---------------------------
> > De{*word*81} Exception Notification
> > ---------------------------
> > Project Dropspot.exe raised exception class EOleException with message
> > 'ORA-00937: not a single-group group function'. Process stopped. Use
Step
> or
> > Run to continue.
> > ---------------------------
> > OK   Help
> > ---------------------------
> > }

> >     result:=(Fields[0].AsInteger=1);
> >     close;
> >   end;
> > end;

Re:not a single-group group function


Hi Bryan,

 I also perform a 'select count(1)' or 'Select count(*)' in my programs and
do not encounter any problems and I use parameters in my queries.

Do you set the 'datatype' for the parameter?

Regards,

Michael

Quote
"Bryan Valencia" <br...@209software.com> wrote in message

news:3ef7680e$1@newsgroups.borland.com...
Quote
> Actually, it works fine when I ask Delphi to insert the parameter in to
the
> SQL, but not as a parameterized query.

> "Michael Jacobs" <iq...@earthlink.net> wrote in message
> news:3ef5951b@newsgroups.borland.com...
> > Hi Bryan,

> >   if you're recieving an ORA-937,  the SQL statement is not what you
think
> > it is and conains a 'GROUP BY' clause.  Another possibility is that your
> > underlying table is actually a view with a 'GROUP BY' in it.

> > Cause: A SELECT list cannot include both a group function, such as AVG,
> > COUNT,
> > MAX, MIN, SUM, STDDEV, or VARIANCE, and an individual column expression,
> > unless
> > the individual column expression is included in a GROUP BY clause.

> > Action: Drop either the group function or the individual column
expression
> > from
> > the SELECT list or add a GROUP BY clause that includes all individual
> column
> > expressions listed.

> >   Are you specifically setting the SQL in the query in your function or
do
> > you rely upon the component to have the statement prior to entering your
> > function?

> > Regards,

> > Michael

> > "Bryan Valencia" <br...@209software.com> wrote in message
> > news:3ef398c1$1@newsgroups.borland.com...
> > > I'm new to D7, having a lot of exp with D1-5.  Using a TADOQuery...
> > > Oracle DB, Win2000.

> > > function Tdm.IsValidLoan(Lnkey: string): boolean;
> > > begin
> > >   with qValidLoan do
> > >   begin

> > > //this is the sql...
> > > //  select count(1) from dblocks where lnkey = :LNKEY

> > >     Parameters.ParamByName('LNKEY').Value:=Lnkey;
> > >     open;

> > > {
> > > ---------------------------
> > > De{*word*81} Exception Notification
> > > ---------------------------
> > > Project Dropspot.exe raised exception class EOleException with message
> > > 'ORA-00937: not a single-group group function'. Process stopped. Use
> Step
> > or
> > > Run to continue.
> > > ---------------------------
> > > OK   Help
> > > ---------------------------
> > > }

> > >     result:=(Fields[0].AsInteger=1);
> > >     close;
> > >   end;
> > > end;

Other Threads