🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #384

ORA-00979 Group By error message

#384
From: Bud1960
Date: Mon, 25 Sep 2006 19:35
75 lines
3415 bytes
Hello,

I have an Oracle SQL script called "Time_Sheet_Progress.sql" that causes an ORA-00979 GROUP BY error when run in BDS, but runs fine in both SQL*Plus and TOAD.

[script]
SELECT a.spriden_last_name AS "Emp Last Name",
       a.spriden_first_name AS "Emp First Name",
       b.spriden_last_name AS "Mgr Last Name",
       b.spriden_first_name AS "Mgr First Name",
       case when perjobs_status_ind = 'C' then 'Complete'
            when perjobs_status_ind = 'A' then 'Approved'
            when perjobs_status_ind = 'E' then 'Error'
            when perjobs_status_ind = 'I' then 'InProcess'
            when perjobs_status_ind = 'R' then 'Returned'
            when perjobs_status_ind = 'P' then 'Pending'
            else perjobs_status_ind
       end AS "Job Status",
       case
         when perrout_queue_status_ind = 'A' then 'Approved'
         when perrout_queue_status_ind = 'O' then 'Overridden'
         when perrout_queue_status_ind = 'Q' then 'InQueue'
         when perrout_queue_status_ind = 'P' then 'Pending'
         else perrout_queue_status_ind
       end AS "Queue Status",
       perjobs_comment AS "Comment",
       perrout_status_date_time AS "Status Date",
       perjobs_payno AS "Pay No",
       SUM(NVL(perhour_hrs,0)) AS "# Hrs."
  FROM spriden a,
       spriden b,
       perrout,
       perhour,
       perjobs
WHERE  a.spriden_pidm = perjobs_pidm
   AND a.spriden_change_ind IS NULL
   AND b.spriden_pidm = perrout_appr_pidm
   AND b.spriden_change_ind IS NULL
   AND perhour_jobs_seqno (+) = perjobs_seqno
   AND perrout_jobs_seqno = perjobs_seqno
   AND perjobs_payno = :payno -- perjobs_payno is an integer value
GROUP BY a.spriden_last_name,
         a.spriden_first_name,
         b.spriden_last_name,
         b.spriden_first_name,
         perjobs_status_ind,
         perrout_queue_status_ind,
         perjobs_comment,
         perrout_status_date_time,
		 perjobs_payno
[/script}

[code]

TStringList *sl = new TStringList;
sl->LoadFromFile("Time_Sheet_Progress.sql");
ADOQuery1->SQL->Text = sl->Text;

ADOQuery1->Parameters->ParseSQL(ADOQuery1->SQL->Text, true);
ADOQuery1->Parameters->Items[0]->Value = txtPayNo->Text.ToInt();

  // Set the query in active mode.
try {
	ADOQuery1->Active = true;
// ... other stuff
} catch (Exception &ex) {
// The error brings me here...
				ShowMessage("There has been an error.\rPlease notify the Computer Center of the following message:\r\r\t" + ex.Message);
}
[/code}

If anyone has any idea how to work around this, please post it.

TIA,
Bud
Technical Details
Message-ID: <45182f98$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,eb84d3ca99d5dde4,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bud1960" <amanz@northweststate.edu>
Sender: "Bud1960" <amanz@northweststate.edu>
Reply-To: "Bud1960" <amanz@northweststate.edu>
Subject: ORA-00979 Group By error message
Newsgroups: borland.public.cppbuilder.database.ado
X-User-Info: 205.133.102.124     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <45182f98$1@newsgroups.borland.com>
Date: 25 Sep 2006 12:35:52 -0700
X-Trace: newsgroups.borland.com 1159212952 207.105.83.66 (25 Sep 2006 12:35:52 -0700)
Lines: 75
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail