How can I use User-Defined Aggregate Functions in Timesten 11? such as ODCI
Hi
we are using Timesten 11 version and as per the documentation, it doesn't support User-Defined Aggregate Functions.
So we are looking for alternatives to do it. Could you please provide your expert voice on this.
Thanks a lot.
As the following:
create or replace type strcat_type as object (
cat_string varchar2(32767),
static function ODCIAggregateInitialize(cs_ctx In Out strcat_type) return number,
member function ODCIAggregateIterate(self In Out strcat_type,value in varchar2) return number,
member function ODCIAggregateMerge(self In Out strcat_type,ctx2 In Out strcat_type) return number,
member function ODCIAggregateTerminate(self In Out strcat_type,returnValue Out varchar2,flags in number) return
number
How can I use User-Defined Aggregate Functions in Timesten 11? such as ODCIAggregateInitialize ?
Dear user6258915,
You absolutely right, TimesTen doesnt support object types (http://docs.oracle.com/cd/E13085_01/doc/timesten.1121/e13076/plsqldiffs.htm) and User-Defined Aggregate Functions.
Is it crucial for your application? Could you rewrite this functionality by using standart SQL or PL/SQL?
Best regards,
Gennady
Similar Messages
-
PL/SQL : User defined Aggregate Functions ??
Is it possible to create (using whatever language) a user defined aggregate function for transparent usage within sql ?
e.g.
select median(myField) from myTable
or
select empirical_expectation(myField) from myTable
thanx in advance ..
Tobias ObersteinHI,
U can create a stored proc. (PL/SQL) for this and call as any other function.
By using external procedure, U can create shared library in C or C++ and coonect this shared library by using external function/procedure. This will be become user-defined procedure.
with regards,
Boby Jose Thekkanath. -
User-Defined Aggregate Function in oracle
Somebody knows if in oracle 10g is possible to create a User-Defined Aggregate Function?
Sometingh like my_sum, that aggregate the values in a way that i want...
select manager, my_sum(salary)
group by manager
In internet i've found rellay notingh for oracle 10g...can somebody help me? Thank's in advance!Thank's to everybody!!! I've made my custom function sum_distinct
create or replace type AggregateCD as object
( nb number,
ListOfDistinctValue clob,
static function ODCIAggregateInitialize(sctx IN OUT AggregateCD) return number,
member function ODCIAggregateIterate(self IN OUT AggregateCD, value IN VARCHAR2) return number,
member function ODCIAggregateTerminate(self IN AggregateCD, returnValue OUT number, flags IN number) return number,
member function ODCIAggregateMerge(self IN OUT AggregateCD, ctx2 IN AggregateCD) return number
create or replace type body AggregateCD is
static function ODCIAggregateInitialize(sctx IN OUT AggregateCD) return number is
begin
sctx := AggregateCD(0,null);
return ODCIConst.Success;
end;
member function ODCIAggregateIterate(self IN OUT AggregateCD, value IN VARCHAR2) return number is
ListOfValue CLOB:=self.ListOfDistinctValue ;
begin
self.nb:=self.nb+to_number(substr(value , INSTR(value, ';', 1, 1)+1 ,length(value)));
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self IN AggregateCD, returnValue OUT number, flags IN number) return number is
begin
returnValue := self.nb;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self IN OUT AggregateCD, ctx2 IN AggregateCD) return number is
begin
self.nb := ctx2.nb;
return ODCIConst.Success;
end;
end;
CREATE OR REPLACE FUNCTION sum_distinct (input VARCHAR2) RETURN number
PARALLEL_ENABLE AGGREGATE USING AggregateCD;you can use so:
select sum_distinct(distinct t.primary_key||';'||t.import)
from table1 t, table2_with_bad_join
it's the same of
select sum(t.import)
from table 1 -
8i personal : error when Create user defined aggregate function
Hi,
I have problem on creating user defined aggregate function.
I try to create the sample aggregate function "SecondMax" from 9i developer guide(append at the end of this post).
It's work to create object type and the type body, but
there is error when I create the aggregate function..
"CREATE FUNCTION SecondMax (input NUMBER) RETURN NUMBER
PARALLEL_ENABLE AGGREGATE USING SecondMaxImpl;"
I am using 8i personal now.. is that the syntax of create function in 9i is different from that in 8i?
Example: Creating and Using a User-Defined Aggregate
This example illustrates creating a simple user-defined aggregate function SecondMax() that returns the second-largest value in a set of numbers.
Creating SecondMax()
Implement the type SecondMaxImpl to contain the ODCIAggregate routines.
create type SecondMaxImpl as object
max NUMBER, -- highest value seen so far
secmax NUMBER, -- second highest value seen so far
static function ODCIAggregateInitialize(sctx IN OUT SecondMaxImpl)
return number,
member function ODCIAggregateIterate(self IN OUT SecondMaxImpl,
value IN number) return number,
member function ODCIAggregateTerminate(self IN SecondMaxImpl,
returnValue OUT number, flags IN number) return number,
member function ODCIAggregateMerge(self IN OUT SecondMaxImpl,
ctx2 IN SecondMaxImpl) return number
Implement the type body for SecondMaxImpl.
create or replace type body SecondMaxImpl is
static function ODCIAggregateInitialize(sctx IN OUT SecondMaxImpl)
return number is
begin
sctx := SecondMaxImpl(0, 0);
return ODCIConst.Success;
end;
member function ODCIAggregateIterate(self IN OUT SecondMaxImpl, value IN number)
return number is
begin
if value > self.max then
self.secmax := self.max;
self.max := value;
elsif value > self.secmax then
self.secmax := value;
end if;
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self IN SecondMaxImpl, returnValue OUT
number, flags IN number) return number is
begin
returnValue := self.secmax;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self IN OUT SecondMaxImpl, ctx2 IN
SecondMaxImpl) return number is
begin
if ctx2.max > self.max then
if ctx2.secmax > self.secmax then
self.secmax := ctx2.secmax;
else
self.secmax := self.max;
end if;
self.max := ctx2.max;
elsif ctx2.max > self.secmax then
self.secmax := ctx2.max;
end if;
return ODCIConst.Success;
end;
end;
Create the user-defined aggregate.
CREATE FUNCTION SecondMax (input NUMBER) RETURN NUMBER
PARALLEL_ENABLE AGGREGATE USING SecondMaxImpl;
Using SecondMax()
SELECT SecondMax(salary), department_id
FROM employees
GROUP BY department_id
HAVING SecondMax(salary) > 9000;This could be a x64/x86 problem. Try following this thread
[GetCompanyService|GetCompanyService] and recompile your code for the platform you need. -
Help! Can I have user defined extension function?
Under SQL Sever XML, I can write a xsl script like this:
<msxsl:script language="JScript" implements-prefix="myfunc">
function getvalue(nodelist,name,istag){
var subNode=nodelist.nextNode();
if(subNode == null) return('?');
if(istag == '') name = '@' + name;
var value=subNode.getElementsByTagName(name);
return((value == null)?'':value);
</msxsl:script>
and I can call this function in the xsl, obviously, msxsl supported by microsoft. I know that Oracle XML support Extension function, but you can tell here that I want a user defined function while not a predefined function. Can I have such feature with Oracle XML, and How? Thanks.Oracle XML support Extension function.
For example:
If we would like to import FAQDBUri.class with user-defined java functions, like TranslateDBUri(), we can write XSL file like this:
<xsl:template match="/" xmlns:dburig="http://www.oracle.com/XSL/Transform/java/FAQDBuri">
<xsl:variable name="urladd" select="dburig:TranslateDBUri($url)"/> -
Using user defined text functions to generate strings on button.
I am new to java programming and am facing a problem.. It would be great if you could help me resolving it..
The problem is:
Is it possible to use user defined functions to generate the string on a button(button name)?
If it is possible please educate me on it..
Thanks..Yes its possible. What you ask is so vague that it can be interpreted in so many ways there are plenty correct answers
public void userDefinedFunction(String aString)
yourButton.setText(aString);
} -
I developed our own Authentication, Identity Assertion & Authorization providers
for weblogic 8.1 SP1. In the authenticator MBean i have one method which takes
user defined object as a argument and returns a user defined object. i am able
to call all the methods which takes java objects(for example: String, int, ArrayList,
HashMap, Etc...) as a argument and returns also a java object but when i user
any user defined object then it gives exception. if in the argument i used user
defined object then it is not able to call that method telling NoSuchMethodException.
Is there any way to use user defined object as an argument to MBean method?
can anyone please help us as we r in the final stage of the project?
Thanks
Lakshmi"Lakshmi Padhy" <[email protected]> wrote in message
news:3fc2f50c$[email protected]..
>
I developed our own Authentication, Identity Assertion & Authorizationproviders
for weblogic 8.1 SP1. In the authenticator MBean i have one method whichtakes
user defined object as a argument and returns a user defined object. i amable
to call all the methods which takes java objects(for example: String, int,ArrayList,
HashMap, Etc...) as a argument and returns also a java object but when iuser
any user defined object then it gives exception. if in the argument i useduser
defined object then it is not able to call that method tellingNoSuchMethodException.
>
Is there any way to use user defined object as an argument to MBeanmethod?
>
I seem to remember that jmx only supports scalar datatypes. Ask in the
weblogic.developer.interest.management newsgroup. -
How can we handle user defined exceptions in ejbStore() of entity bean
Accroding to my knowledge in ejbStore we can not handle user defined exceptions. Can anybody help on this????
In my case I am calling a method from ejbsotre() . In that method i wanted to put some checks according to that i wanted to throw exceptions.
In this case how would I handle exceptions.
Can you suggest in this case,please !!! -
How can I find user defined functions in oracle
Hello All,
I need to find out what are the user defined functions available in my schema?
Please let me know on what system tables shall I query and find out the user defined functions?
Thanks,
Milind.Thanks Satish,
One more query. Can I find what are the parameters that needs to be passed?
Here is what I have to do..
I have to find all the accessible user defined functions. If I select one of them in my UI, I need to show the parameters used in the respective function.
Please let me know if these parameters are stored anywhere..
Thanks again,
Milind -
Lookiing for example of a user define aggregate function in Java
I want to write an aggregate function in Java. Every example I found is in PL/SQL.
I have written my fair share of JSPs, but this is different in that it is methods off an object.
The documentation says it can be done in Java, but it's not clear to me how to define the ODCIAggregateInitialize, ODCIAggregateIterate, ODCIAggregateTerminate, and ODCIAggregateMerge methods.
If any one can point me to, or send me, an example, I would be very grateful.
TIAHii Greg:
You can find the code to implement a Domain Index for Oracle which uses ODCI Api in Java at.
http://dbprism.cvs.sourceforge.net/viewvc/dbprism/ojvm/src/java/org/apache/lucene/indexer/LuceneDomainIndex.java?revision=1.29&view=markup
This is the code of the implementation of the Lucene Domain Index:
http://docs.google.com/Doc?id=ddgw7sjp_54fgj9kg
The strategy to implement an use aggregate function is similar to implement a Domain Index.
The PLSQL wrapper for the above code is:
http://dbprism.cvs.sourceforge.net/viewvc/dbprism/ojvm/db/LuceneDomainIndex.sql?revision=1.20&view=markup
Take a look at the code and if you have another question just drop me an email or post again into this list.
Best regards, Marcelo. -
How can give the user defined parameter in alv report
Hi experts
I have created one alv report for Sale Order statement.In this alv report have different input parameters
My problem is in this alv i have two input field Sales Orgaization and Plant.When I set this parameter value in user details it snot affected in my alv report.But it is affected in the standard alv report.How can
i rectify this
Regards
Manojhi
i think don't use set parameter value, use there SUBMIT & RETURN statement and write in USER_COMMAND function.
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
SUBMIT program name AND RETURN
WITH <selection-screen field> IN <selection-screen field>
WITH WERKS IN WERKS .
ENDFORM .
Regards,
Abhi -
Using User Defined Global Functions
Hi,
I am implementing Error Handling in a package. The logic goes like this:
If the call to the first interface fails, KO will call the error proc using which error message is extracted, written to a file and an email notification is sent.
The code given below is written in the procedure.
OdiOutFile -FILE=E:\OraHome_2\oracledi\demo\Assignmnt\ErrorLog.log
ErrMesg:'<%=odiRef.getPrevStepLog("MESSAGE")%>'
Now i need to implement this using a global function which can be used across interfaces to implement error handling.
i want to club the code used above with sending an email notification.
Can anyone pls guide me if i my approach is correct and how this approach can be implemented using Global Function?
Thanks.
Edited by: RitikaS on Dec 18, 2009 2:19 AMHi Ritika,
Can i suggest a method?
Build a package, define your interface flow, from the KO (failure) of every interface call OdiSendMail.
In the OdiSendMail define all the parameters like Mail Server,From, To, Subject and in the message body paste the below code,
Previous step <%=odiRef.getPrevStepLog("STEP_NAME")%> with session number <%=odiRef.getPrevStepLog("SESS_NO")%> failed with the error message
*<%=odiRef.getPrevStepLog("MESSAGE")%> .*
Please look into the operator for more details.
So what ODI will do is, it will send a notification to the recipient with the error message ,interface name and session number.
Sample :
Previous step INT_LOAD_AGE with session number 1822124 failed with the error message
17002 : null : java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:274)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:328)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:361)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:595)
at com.sunopsis.sql.SnpsConnection.u(SnpsConnection.java)
at com.sunopsis.sql.SnpsConnection.c(SnpsConnection.java)
at com.sunopsis.sql.i.run(i.java)
Please look into the operator for more details.
Makes sense?
http://img259.imageshack.us/img259/1704/screenshot003.jpg
P.S: Please do close your threads accordingly assigning points (Helpful/Correct) to make experts to help you eagerly.
Thanks,
Guru -
How can I set user-defined characteristics's range in pa cycle's receiver?
I created user-defined characteristics in PA which have no check validation.
When I create PA assessment cycle, I want to set it's range in cycle's receivers side.
User-defined characteristics in PA which have no check validation don't have range selection function in cycle's receivers side.
How can I set it's range in cycle's receivers side ?Hi,
You can do the same by creating SETS. You can create the same from header menu at the time of entering receivers during creation of assessment cycles.
Regards
Hemant -
How can I enter user defined info into a seq file
I would like to insert some user defined information that I can extract either viac C-code (step invoked) or from the Operator Interface once the seq file has been loaded into memory.
Hi hurst,
You probably want to create a dialog panel that will allow the user to enter the information.
Where you store this information really depends on how much of the sequencefile needs to have access to this information.
If its global then writing it to either StationGlobals or to FileGlobals. Writting to StationGlobals means it going to be available after the execution of your sequencefile has finished. Writing to FileGlobals means its only going to be available during the execution of your sequencefile and also only in scope for the sequencefile its contained in. Unless you change the default setting so that all sequencefiles use the same FileGlobals.
To get the information to the SequenceFile will be by TestStand API calls using the PropertySetValue.
Another way would be to use the propertyloader.
There are plenty of examples either with TestStand or on the NI website on transferring data of all types from a step during execution.
This is a bit general. Maybe if you can expand on your query.
hope this helps
Regards
Ray Farmer
Regards
Ray Farmer -
How do you use user defined error messages in Value Help?
Hi,
I'm currently working on a Modifiable Value Help Selector in Web Dynpro Java, and I want to use a user defined error message when I validate the values entered by a user. Currently, it's returning its default error message ("Character <string> does not match...").
Since the project requires a different error message, is there a way to override the default error message and use my defined error message instead?
Thanks!Hi Angelo,
I am not sure why message area is showing both Custom and inbuilt messages but you can try the following:
i guess you must be using reportContextAttribute exception for showing Error messages on the input fields as well.in that case you can disable the message area so messages will appear only on the Context level ie; on input fields.
For other messages apart from validation messages you can enable the message area before reporting the exception.
make sure the boolean context variable which will be used for enabling and disabling the message area should have Readonly property set as true.
I am not sure whether this is the only solution for this but you can try and see if it works.
Siddharth
Maybe you are looking for
-
Why is BT incompetent and unable to resolve a simp...
This has been an on-going issue with BT for a number of months in which BT has made multiple failing and I am now beginning to lose patience. The issue began when I moved house and took my BT services with me. During the house move I requested that t
-
how can I delete videos and photos from my device after downloading them from iCloud to free up space.
-
IE renders spry accordion glitchy and unusable (FF works perfectly)
Hi everyone, I'm making my Dad a website and I've adapted a spry accordion into a large table that expands the row over mouseover. The problem is that internet explorer (only tested in 7 so far) renders it almost unusable, however it looks fine in go
-
Can't find location on iPad after upgrade
Upgraded yesterday to iOS 8.1, and now my iPad "can't determine location" . Find my iPhone turned on, location services enabled. First tried to reset settings, then tried erasing all settings and data, then load backup. Finally did a restore via iTun
-
Formatted Text field for File Extensions
Hi guys, Is it possible to create formatted text field for file extension like it should accept *.bmp, .bmp, bmp. etc..... It is not necssary to be a Combo Box. TextField will work. Thanks in advance. AZGHAR