Does EJBQL in JDeveloper support max aggregate function ?
Does EJBQL in JDeveloper support max aggregate function ?
I can't get it to work using select max(o.time) from MyObject o; It always returns the MyObject to me.
Anybody knows how to do this ?
Thanks.
No one knows how exactly this works in JDeveloper 11g? As I see it, it's most likely a bug. For one, JDeveloper already supports plenty of databases and enforces some limitations on the useability of these databases where necessary (for instance, JDBC Positioning instead of Oracle's way of binding for the bind variables in a query). However, this enforcement does not happen with the WHERE clause of the view criteria in MySQL when you choose an operator that concatenates strings together in the WHERE clause, such as "contains". You'd expect it's smart enough to use different syntax for concatenating the strings, depending on the database (e.g., CONCAT for MySQL, || for Oracle). Second, lack of this enforcement should not break functionality, and here it does (searching with wildcards in LOV is just not possible declaratively with MySQL), which resembles a bug in the software.
For now, I've completely rewritten the LOV in Java, so it's not declarative anymore, but programmatic. It works, resembles searching with "contains" and it stays that way, despite of the higher difficulty in maintenance, until this issue can be solved declaratively, by any means: via a patch release or via a workaround. I hope someone can provide me (and quite possibly others facing this issue) with insight upon this.
Thanks in advance.
Similar Messages
-
Does LDS 1.1 Support use-defined functions?
Does LDS 1.1 Support use-defined functions? I'm working with the W3C use case
REL Q12 which fails with the function, but succeeds if I "inline" the function.LD 1.1 does not support User Defined Functions. This feature was omitted for performance
reasons.
- Mike
"Mark Maxey" <[email protected]> wrote:
>
Does LDS 1.1 Support use-defined functions? I'm working with the W3C
use case
REL Q12 which fails with the function, but succeeds if I "inline" the
function. -
Hi,
in VBAK table i need latest date entered i.e max date value, field is ERDAT
can anybody write syntax for this
select max( ERDAT )
from vbak
into maxfeild
group by ERDAT.
endselect.
i think it is wrong can anybody write correct syntax.Try using this code.
IF NOT it_ekpo[] IS INITIAL.
SELECT ebeln
ebelp
etenr
eindt
menge
wemng
FROM eket
INTO TABLE it_eket
FOR ALL ENTRIES IN it_ekpo
WHERE ebeln EQ it_ekpo-ebeln
AND ebelp EQ it_ekpo-ebelp.
IF sy-subrc EQ 0.
SORT it_eket BY ebeln ASCENDING
ebelp ASCENDING
eindt DESCENDING.
DELETE ADJACENT DUPLICATES FROM it_eket COMPARING ebeln
ebelp.
ENDIF.
ENDIF.
check the below link :
GETTING LATEST DATE
Thanks
Seshu
Message was edited by:
Seshu Maramreddy -
Aggregate functions in EJBQL ???
Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL?
Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL? Hi Swami --
The latest version of Oracle9iAS - v903 is J2EE 1.3 compatible so it supports all of the EJB 2.0 specification.
The EJB 2.0 specification lists the following functions for EJBQL:
String Functions:
CONCAT(String, String) returns a String
SUBSTRING(String, start, length) returns a String
LOCATE(String, String [, start]) returns an int
LENGTH(String) returns an int
Arithmetic Functions:
ABS(number) returns a number (int, float, or double)
SQRT(double) returns a double
The latest version of the EJB 2.1 specification which will be part of J2EE 1.4, has added support for aggregate functions like orderby, sum, count, etc.
11.2.7.2 Aggregate Functions in the SELECT Clause
The result of an EJB QL query may be the result of an aggregate function applied to a path expression.
The following aggregate functions can be used in the SELECT clause of an EJB QL query: AVG,
COUNT, MAX, MIN, SUM.
We will support these when the EJB 2.1 specification is finalized and we produce our J2EE 1.4 compatible implementation.
cheers
-steve- -
hi evrybdy
can we use MAX aggregate function to pick a field of type char from database table ...if yes thn how ..?
plzzz ans soon .
thank u .No. Max is only for numbers. ( even it will not work for NUMC type )
OPENSQL statements will not work as ASCII format.
Cheers
Kothand -
Pivot table wihtout Aggregate Functions ( Urgent Please. )
I am trying to select date and time. But having a hard time since I dont have any aggregate function that is needed. Just pivot the rows to columns.
IN sql
stage
starttime
endtime
1
1/22/2011 15:31
1/22/2011 15:32
2
1/22/2011 15:33
1/22/2011 15:34
3
1/22/2011 15:35
1/22/2011 15:36
Required
starttime_s1
endtime_s1
starttime__s2
endtime_s2
starttime_s3
endtime_s3
1/22/2011 15:31
1/22/2011 15:32
1/22/2011 15:33
1/22/2011 15:34
1/22/2011 15:35
1/22/2011 15:36What is it that you're trying to accomplish with this?
The reason I ask is that pivoting data is a display function and therefore best left to the application or reporting tier.
If you're going to insist on "driving screws with a hammer" and really want to do this in SQL, the next question is, Is there a set number of "Stages" that will exist? Is it always going to be 3 stages and only 3 stages?
If the answer is YES, there will be a fixed number of stages, then it's a simple thing to do with either a PIVOT or CASE statements. (my personal preference is to use case statements, especially if you're pivoting 2 or more columns)
If the answer is NO, the number is stages can vary... You're left with a Dynamic PIVOT. Dynamic Pivots are a bit more complex to write but there is enough sample code out on the interwebs that you won't have a problem finding the correct syntax.
The real problem with a Dynamic Pivot query is the fact that it's pretty much useless. You can't do much (if anything at all) with it... Due to the fact that they have variable numbers of columns, they can't be used in views or procs and I can't think of
a singe, off the shelf, reporting platform that will allow accommodate data source that has a different number of columns every time it executes... So unless you're going to be content looking at the results in SSMS or developing a custom application, I don't
see the point.
Also... Aggregates aren't a problem based on the data you're showing. You only have 1 start time and 1 end time per stage. Using either the MIN or MAX aggregate functions will work to give you the desired result.
Anyway, hope that helps,
Jason
Jason Long -
EJB 3.0: EJBQL aggregate functions not working properly
Hi!
We are experiencing problems when using aggregate functions within EJBQL queries. In my case, we have to use max() function to retrieve the max start_date from a specific table. In order to do this, we wrote the following code:
String strQuery = "select max(o.dt_fim) from Questionario o";
Query queryTeste = em.createQuery(strQuery);
List x = queryTeste.getResultList();
OBS: dt_fim is an Oracle 10g datetime column, with its corresponding entity attribute in Questionario entity class.
AFAIK, the query above should return only one record (object instance) containing the date value, right? However, it brougth a list of the entity objects, corresponding to all records in the table, as we had just run "select o from Questionario o".
Examining the server log we can see this behavior:
[TopLink Fine]:2006.09.12 01:47:55.526--
ServerSession(7119662)--Connection(7048401)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])
--SELECT ID_QUEST, DT_INICIO, DT_FIM, DS_QUEST, DT_CRIACAO, TP_QUEST, NM_QUEST, COD_SEGMENTO, ID_GRUPO FROM TBBOP_QUEST
Are anyone experiencing this issue?
Is there any workaround?
Any help would be much appreciated, since we need to deploy the application for user testing asap.
Thanks in advance.
Best regards,
Gustavo
PS: We are using JDeveloper 10.1.3.0.4(SU4)
Message was edited by:
Gustavo Lopes SobralThe 10.1.3.0 versions of JDeveloper contain our early preview of EJB 3.0 JPA functionality. One limitation is that the query language is not complete (released before the spec was finalized).
You can use TopLink Essentials (JPA Reference implementation) whihc contains a complete compliant implementation of the final specification.
http://otn.oracle.com/jpa
The 10.1.3.1 JDeveloper preview ships with TopLink Essentials.
Doug -
What does AverageOfChildren aggregate function in SSAS 2005 actually do?
Folks,
Have any of you been playing around with SSAS 2005 to have worked out
what the AverageOfChildren aggregate function actually does?
I was expecting it to do the equivalent of a simple AVG() with a GROUP
BY in SQL, but it seems to be doing something additional to that.
No-one in the team I work in has been able to work out what exactly it
is doing.
Any info would be appreciated!
Cheers,
KennethThis very question was recently discussed in the public SQL Server OLAP newsgroup:
http://groups.google.com/group/microsoft.public.sqlserver.olap/msg/c662e201b99678bc
>>
Aggregate Function Average of Children does not work
This behavior could occur because
AverageOfChildren,FirstChild,LastChild,FirstNonEmpty and LastNonEmpty are
semi-additive and treats the Time dimension different from the other
dimensions. Please refer to the following link for details:
http://msdn2.microsoft.com/en-us/library/ms175356.aspx
The description in above link (BOL) is not very clear about
AverageOfChildren, and I have forward this feedback to the proper channel.
The AverageOfChildren only applys when aggregating via Time dimension.
Actually, when you try to create a new measure in cube, when you select
usage, you could see "average over time" which is for AverageOfChildren.
To get the result of average behavior you want, you may want define a Sum
and a Count measure, then create a calculated measure (in the cube script)
which divides the two base measures.
>> -
Aggregate functions like 'max' in XQuery..
Hello,
I am trying to find the max of one of the fields in the table using XQuery aggregate function: fn:max as described in the below URL:
http://e-docs.bea.com/aldsp/docs30/xquery/sql_pushdown.html
Here is what I have:
declare $lineNo as xs:int :=
for $pd in ns4:getAllPalletDtls()
group $pd/LINE_NO as $line_group
by 1
return fn:max($line_group);
However, it's giving me error at line # 3 above:
Invalid expression: Expecting AS, found '/'
I am getting this error in ALDSP3.0.1 Aqualogic Data Service Studio.
Could someone please let me know what is wrong with the above code.
Thanks a lot,
Mamta"group" expects to be followed by a variable (not an expression). If you add a 'let' with your expression you can create the following which is more inline with your original query
declare $lineNo as xs:int :=
for $pd in ns4:getAllPalletDtls()
let $lineNo := $pd/LINE_NO
group $lineNo as $line_group
by 1
return fn:max($line_group); -
Does Report Builder 6i support Spatial Functions
Does Report Builder 6i support spatial functions? I would like to use the following query in a report:
SELECT id, rseq
FROM gps a, user_sdo_geom_metadata m
WHERE m.table_name = 'GPS'
and mdsys.sdo_lrs.is_geom_segment_defined (a.geom, m.diminfo) = 'FALSE' and a.id like '01%'
It does not recognize the spatial LRS function. This query does not return geometries but rather will only return tabular information.
Thanks
DaveHello,
Your colleague is right. Even if the SQL query is executed by the DB server , Reports needs to parse the SQL query.
The SQL parser included in Reports 6i is based on 8.0.6
You can see this version in the Reports Builder help :
Menu : Help -> About Reports Builder ...
ORACLE Server Release 8.0.6.0.0
Regards -
Does jDeveloper support activity links?
I have tried jDev 10.1.3.3 as well as 11g tech preview 4.
Does jDeveloper support modeling of activity links? I can't seem to find that anywhere. An example of how links are used:
<flow ...>
<links>
<link name="checkFlight-To-BookFlight" />
</links>
<documentation>
check availability of a flight, hotel and rental car concurrently
</documentation>
<invoke name="checkFlight" ...>
<sources>
<source linkName="checkFlight-To-BookFlight" />
</sources>
</invoke>
<invoke name="checkHotel" ... />
<invoke name="checkRentalCar" ... />
<invoke name="bookFlight" ...>
<targets>
<target linkName="checkFlight-To-BookFlight" />
</targets>
</invoke>
</flow>
An article http://www.it-eye.nl/weblog/2006/10/20/benefit-from-concurrent-flows-and-activity-links-in-bpel-ws/ mentions that "Oracle BPEL designer (JDeveloper plug-in) doesn’t support it yet, although it is supported run-time by the Oracle BPEL engine". The article is from 2006, is this still the case?Yes. You just can't use the YouTube widget. You need to go to the Youtube page and get the embed code and add that to the standard HTML snippet in iWeb.
OT -
Does Struts frame work supports Onclick function or not ...?
HI,
Does TLD support Onclick() onMouseOver Function or not ...?What? Haven't you read what this forum is about?
By the way STRUTS just copies the attribute to underlying html (meaning the language, not the string) tag (if onclick is allowed, as you can easily check reading tld or pressing Ctrl+Space in any IDE). So support depends on the browser. Bye. -
Aggregate Function in a report region does not work.
I have a Reports Region with a Region Source that contains an aggregate function. But when I run the page, the value of the function is not returned. I suspect it is a simple syntax error. can somebody tell me what is wrong with
select "TAG_PERIOD_START_DATE", MIN("ORDER_NUMBER")
from "#OWNER#"."TAG_ORDER"
group by "TAG_PERIOD_START_DATE"
order by "TAG_PERIOD_START_DATE"
The problem is probably with the MIN("ORDER_NUMBER") part. I tried several versions of that, but none worked.
The Grouping works fine -- the query returns the TAG_PERIOD_START_DATE, just not the value of the function.
BTW, this query works in SQL Plus (with the quotes removed, of course).
Thanks for any suggestion you may have.When I just made a change to the SQL, I got a message stating:
You have requested to change the Interactive Report query. If you added columns to the query, they will not be displayed when the report is run. You will need to use the actions menu and either select the columns or click Reset. If you removed any columns from the query, it will disable existing filters, highlight rules, and other report settings referencing those columns. Please confirm your request.
So maybe that was the cause of the problem yesterday. Where is the "Actions menu"? -
Trying to create a Histogram type/object for aggregate functions
Hi,
I am trying to create an aggregate function that will return a histogram
type.
It doesn't have to be an object that is returned, I don't mind returning
a string but I would like to keep the associative array (or something
else indexed by varchar2) as a static variable between iterations.
I started out with the SecondMax example in
http://www.csis.gvsu.edu/GeneralInfo/Oracle/appdev.920/a96595/dci11agg.htm#1004821
But even seems that even a simpler aggregate function like one strCat
below (which works) has problems because I get multiple permutations for
every combination. The natural way to solve this would be to create an
associative array as a static variable as part of the Histogram (see
code below). However, apparently Oracle refuses to accept associate
arrays in this context (PLS-00355 use of pl/sql table not allowed in
this context).
If there is no easy way to do the histogram quickly can we at least get
something like strCat to work in a specific order with a "partition by
... order by clause"? It seems that even with "PARALLEL_ENABLE"
commented out strCat still calls merge for function calls like:
select hr,qtr, count(tzrwy) rwys,
noam.strCat(cnt) rwycnt,
noam.strCat(tzrwy) config,
sum(cnt) cnt, min(minscore) minscore, max(maxscore) maxscore from
ordrwys group by hr,qtr
Not only does this create duplicate entries in the query result like
"A,B,C" and "A,C,B" it seems that the order in rwycnt and config are not
always the same so a user can not match the results based on their
order.
The difference between my functions and functions like sum and the
secondMax demonstrated in the documentation is that secondMax does not
care about the order in which it gets its arguments and does not need to
maintain an ordered set in order to return the correct results. A good
example of a built in oracle function that does care about all its
arguments and probably has to maintain a similar data structure to the
one I want is the PERCTILE_DISC function. If you can find the code for
that function (or something like it) and forward a reference to me that
in itself would be very helpful.
Thanks,
K.Dingle
CREATE OR REPLACE type Histogram as object
-- TYPE Hist10 IS TABLE OF pls_integer INDEX BY varchar2(10),
-- retval hist10;
-- retval number,
retval noam.const.hist10,
static function ODCIAggregateInitialize (sctx IN OUT Histogram)
return number,
member function ODCIAggregateIterate (self IN OUT Histogram,
value IN varchar2) return number,
member function ODCIAggregateTerminate (self IN Histogram,
returnValue OUT varchar2,
flags IN number) return number,
member function ODCIAggregateMerge (self IN OUT Histogram,
ctx2 IN Histogram) return number
CREATE OR REPLACE type body Histogram is
static function ODCIAggregateInitialize(sctx IN OUT Histogram) return
number is
begin
sctx := const.Hist10();
return ODCIConst.Success;
end;
member function ODCIAggregateIterate(self IN OUT Histogram, value IN
varchar2)
return number is
begin
if self.retval.exist(value)
then self.retval(value):=self.retval(value)+1;
else self.retval(value):=1;
end if;
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self IN Histogram,
returnValue OUT varchar2,
flags IN number)
return number is
begin
returnValue := self.retval;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self IN OUT Histogram,
ctx2 IN Histogram) return number is
begin
i := ctx2.FIRST; -- get subscript of first element
WHILE i IS NOT NULL LOOP
if self.retval.exist(ctx2(i))
then self.retval(i):=self.retval(i)+ctx2.retval(i);
else self.retval(value):=ctx2.retval(i);
end if;
i := ctx2.NEXT(i); -- get subscript of next element
END LOOP;
return ODCIConst.Success;
end;
end;
CREATE OR REPLACE type stringCat as object
retval varchar2(16383), -- concat of all value to now varchar2, --
highest value seen so far
static function ODCIAggregateInitialize (sctx IN OUT stringCat)
return number,
member function ODCIAggregateIterate (self IN OUT stringCat,
value IN varchar2) return number,
member function ODCIAggregateTerminate (self IN stringCat,
returnValue OUT varchar2,
flags IN number) return number,
member function ODCIAggregateMerge (self IN OUT stringCat,
ctx2 IN stringCat) return number
CREATE OR REPLACE type body stringCat is
static function ODCIAggregateInitialize(sctx IN OUT stringCat) return
number is
begin
sctx := stringCat('');
return ODCIConst.Success;
end;
member function ODCIAggregateIterate(self IN OUT stringCat, value IN
varchar2)
return number is
begin
if self.retval is null
then self.retval:=value;
else self.retval:=self.retval || ',' || value;
end if;
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self IN stringCat,
returnValue OUT varchar2,
flags IN number)
return number is
begin
returnValue := self.retval;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self IN OUT stringCat,
ctx2 IN stringCat) return number is
begin
self.retval := self.retval || ctx2.retval;
return ODCIConst.Success;
end;
end;
CREATE OR REPLACE FUNCTION StrCat (input varchar2) RETURN varchar2
-- PARALLEL_ENABLE
AGGREGATE USING StringCat;GraphicsConfiguration is an abstract class. You would need to subclass it. From the line of code you posted, it seems like you are going about things the wrong way. What are you trying to accomplish? Shouldn't this question be posted in the Swing or AWT forum?
-
Aggregate function for a report that has sets
My report combines similar analysis into sets. I need to apply aggregate function such as Max() to the resulting columns. I tried but Analytics doesn't like that. Can someone tell me if this is supported or not? If not, what would be a workaround?
Have you tried placing the results into a pivot table then assigning this to display MAX results
Maybe you are looking for
-
hi experts i have a question how to find the print program by knowing the scpript name? we use the transaction code f110 to do the payment, then we print the payment advice. In the paying company code setting we know the script name. the user want to
-
What external drive do you need to read discs
What external drive do you suggest purchasing to read discs
-
How do I get rid of ITunes 10 upgrade screen so I can use ITunes Store?
How do I get rid of ITunes 10 ad, so I can use the iTunes store. I can't download 10 on this computer and have purchased from iTunes store in past. Not anymore, any search doesn't work, screen keeps coming back to Upgrade ad.
-
We are in discrete manufacturing scenario with make to stock u201C10u201D. We are entering the PIR through MD61 and taking the MRP on daily basis. My client wants that system should not consider the old PIR during MRP run. For example, I am taking MR
-
Dear All, I'm creating a logic to move beginning balance of January to ending balance of Jan, then carryforward to beginning balance of Feb, and so on. Appreciate very much if you can show me the logic for this purpose. I split my logic into 2 parts: