Re: Question about dynamic SQL

From: Tommy Wareing <p0070621_at_oxford-brookes.ac.uk>
Date: Tue, 21 Jun 1994 16:32:56 GMT
Message-ID: <Crr9yw.B2G_at_uk.ac.brookes>


Larry Cipriani (lvc_at_cbvox1.cb.att.com) wrote:
> In SQL*Plus I can write a query like:
 

> select * from tablename where fieldname = max(fieldname);
 

> How can I do this with dynamic SQL in a Pro*C program ?
 

> I know about dynamic SQL style 4 where you specify field and bind
> descriptors, that much of the program works fine. The error I get
> has to do with the group function max(fieldname) not being allowed.
> I was suprised by this since SQL*Plus allows that selection. I got
> around the error by doing a query for max(fieldname) first and then
> the select * but I would like to do it all in one step if possible.

Our's doesn't allow this (6.0.36). Change the where to having, and all should be ok.

--
  _________________________   _________________________
 /  Tommy Wareing          \ /                         \
|  p0070621_at_brookes.ac.uk   X   'Bugger!' said Piglet   |
 \  0865-483389            / \                         /
  ~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~
Received on Tue Jun 21 1994 - 18:32:56 CEST

Original text of this message