Using external function in xquery

hi all,
i'm using the Java Api to access Berkeley dbxml.
i'm trying to raise a number, i get from the database,to a power
the code i use is :
String Query = "declare namespace power = 'java:java.lang.Math';";
Query += "declare function power:pow($this as xs:double,$val as xs:double) as xs:double external; \n"+
"power:pow(number1,number2)";
XmlQueryContext context = XmlManager.createQueryContext();
XmlResults results = XmlManager.query(str, context, null);
,,when i run the programm the answer is an uncaught exception from the database.
Does somebody know how i can use the external function power?
Message was edited by:
user556027

On closer reflection, I realized that external functions would not help with the problem I described. I suppose I would need to do some parsing on my own side and let Javascript retrieve the files (as with non-XML AJAX), let Firefox convert each file to its inner (well-formed) representation, do any necessary processing to circumvent deliberate attempts to create poorly convertible documents (e.g., a certain famous site's trick to have an attribute like )="", an incomplete DOCTYPE, or comments like <!--- ). Though, I do think it would be nice if BDBXML could do such cleaning up HTML to be well-formed before including it (or even allow non-XML documents to be loaded into a document which was flagged as non-XML where detected as such).

Similar Messages

  • How to use external functions in check constraints

    I created my own function:
    create or replace
    function if_num_get_num (inval in varchar2)
    return number
    is
    dummy number;
    Begin
    dummy := to_number(inval);
    return dummy;
    exception
    when others then return null;
    end;Can I use it in table check constraint?
    When I use standard function INSTR everything is OK.
    ALTER TABLE A_S
    ADD CONSTRAINT A_S_CHK1 CHECK
      (INSTR(NAZWA_ZA, ':') > 0)
    ENABLE;but when I try to create it with my function:
    ALTER TABLE A_S
    ADD CONSTRAINT A_S_CHK1 CHECK
      (IF_NUM_GET_NUM(INSTR(NAZWA_ZA, ':')) > 0)
    ENABLE;I get a message "Invalid column IF_NUM_GET_NUM"

    Read the restrictions.
    >
    Restrictions on CHECK Constraints
    A CHECK constraint requires that a condition be true or unknown for every row of the table. If a statement causes the condition to evaluate to false, then the statement is rolled back. The condition of a CHECK constraint has these limitations:
    * The condition must be a boolean expression that can be evaluated using the values in the row being inserted or updated.
    * The condition cannot contain subqueries or sequences.
    * The condition cannot include the SYSDATE, UID, USER, or USERENV SQL functions.
    * The condition cannot contain the pseudocolumns LEVEL or ROWNUM.
    * The condition cannot contain the PRIOR operator.
    ** The condition cannot contain a user-defined function.*
    >
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_constraints.htm#ADFNS282

  • External Function memory leak

    The ExternalFunction.java sample code distributed with v.2.5.16 has a memory leak.
    You can see this by changing the loop to iterate a million times; eventually it runs out of memory and crashes.
    (I used jdk 1.7 u2 on Windows 7.)
    I tried adding explicit calls to delete() for every created Java object in the example, none of which helped.
    As far as I can tell, it is simply not possible to use external functions from Java without leaking memory.
    Any thoughts on this?

    thanks Silviu
    i create two bugs
    https://bugbase.adobe.com/index.cfm?event=bug&id=3341143
    https://bugbase.adobe.com/index.cfm?event=bug&id=3341146

  • How to call external functions without a .DLL (just using a .H and .LIB file)?

    Hello everyone,
    actually I'm facing little difficulties on how to get an external function getting called from within CVI (Version 2009).
    I was supplied with a .H file and a .LIB file to call an external function from within my CVI project. The .H file looks like this:
    void exportedFunction(double *parameter);
    As far as I know, the external function was written with MS Visual C++ 6.
    So I tried to statically link to the extern al function like this:
    - Add the .H file and the .LIB file to the CVI project
    - #include the .H file where I needed to call the external function
    - do the external function call
    When building I get an unresolved external function call error from CVI so this seems not to be working.
    I made some searches around and got up with two possible issues. Maybe one of you can help me get a bit further and get things working.
    1) The "real" function code is located in the DLL file which was not delivered to me. Or is there a way to get things done (call external functions) just with a .H and a .LIB file (without any .DLL file included)?
    2) The external function does not export according to "C-Style" rules. The function signature in the .H file shows no things like
    extern "C" __declspec(dllexport) void __stdcall ...
     Or maybe it's a combination of both issues (missing .DLL + wrong export style of function)?
    I guess I could get around the wrong export style of the function when I manage to write a wrapper around the original function that actually uses C-Style exporting. But I guess I need the .DLL file for this try as well.
    Thank you for your answers.
    Best regards,
    Bernd
    Solved!
    Go to Solution.

    There is no need  for the dllexport stuff. There is also the option for a static library without any DLL.  But the 'extern "C"' is essential, because it forces the C++  compiler, which was probably used to compile the library , to use C calling convention.
    If you can't ask the provider of the library to provide a version which was compiled using C calling convention the way to go is to write a wrapper with VC++6 around that library which reexports the functions using C calling convertion. Something like
    extern "C" type0 myfunc1(type1 arg1, ...) {
           return func1( arg1,...);
    for every function , you need to use.
    BTW. "unresolved symbol" is the linker error message, you can expect if you try to link C code against a library build with C++ calling convention.

  • Using sap:external-function in XSLT

    In the definition of sap:external-function I don't see any way of specifying the target system. Does this mean that the system is by default the ABAP stack on which XI is running?
    <sap:external-function name="prefix:fName" method="instanceMethod" kind="instance">
       <sap:argument      param="PARAM_1"/>
       <sap:argument      param="PARAM_2"/>
       <sap:result        param="RESULT"      type="xslType"/>
    </sap:external-function>
    Kind Regards,
    Tony.

    Yes. You are right.
    Nilesh

  • Calling a java function from xquery

    Hello,
    I'm pretty new to ODSI and xquery, so forgive me if what I'm asking is too trivial, but I need to find a way to call a java function from inside xquery. I know xquery can do this through external functions, but can't find any example on how the query prolog declaration should be, nor how the function should look like. Could someone enlighten me?
    Thanks,
    Pedro Ivo

    You can do this 2 ways that I know of (Mike probably has more ideas too)
    1. Register an inversion function:
    [How to use an inversion function|http://download.oracle.com/docs/cd/E13167_01/aldsp/docs32/dsp32wiki/Using%20Inverse%20Functions%20to%20Improve%20Query%20Performance.html]
    2. Create a physical data service based on a java function. I have used this approach for both custom JDBC database operations and straight Java processing, with pretty good results.
    Good luck,
    Jeff
    Edited by: jhoffmanme on Apr 14, 2010 9:57 AM

  • Support for DbXml specific functionality in XQuery vs. Shell or API

    Is / will there be any support for doing common commands in pure XQuery rather than just programmatically or through the shell? For example, in the shell I can create / list / delete indexes on a container, output query plans, etc. Are the same functions that are called through the shell available as XQuery functions? possibly in a dbxml function namespace?
    In a related question, but possibly deserving of a new thread if it doesn't already have one - I know XQuilla has the ability to call registered external functions from parsed XQuery, is there a way to tell DbXml to register a function with XQuilla's static context before using it? that would make it possible for me to add the functionality described above myself without disturbing your distributed code.

    Not so handy with C++ (my everday languages are PHP and Java), but if you say it can be done then I'll take a hack at it. If you happen to have examples of how other people have done it and you could point me at them it would be marvelous.
    To answer your second question: "bingo." It mostly means less interface work and brings it closer to what SQL can do in relational databases.
    The project allows the end user to define their own document structures (schema definitions more or less) and then create instances of these documents in a XML editing interface. For each document type, the end user is also able to define a set of named queries (abstracted function declarations) which lets us captures business rules without customizing our PHP code. Because the structure and queries that will be used against the documents are user defined its fairly impossible for me to automatically setup adequate indexes for the container of each set of documents. So I need an interface to allow the user to create / review / delete the indexes themselves.
    We've already created an interface that allows the user to execute arbitrary queries against a selected document. In the future we'd also like this same interface to do result set based content updates (through the XmlModify class) and whole document addition / replacement. So inclusion of index control makes sense as well. We can find ways to use the APIs, it just seems like this could benefit more than just our project.
    Placing the functionality from the shell into xquery extension functions seems analogous to having the UPDATE, DELETE and CREATE syntaxes of SQL.

  • External function specification

    Hi All!
    (Envs: Centos 5.2, Oracle 10.2.0.4)
    According to documentation a developer should provide RETURN clause in the external function parameters declaration.
    But I faced a conflict with additional extproc specific parameters , INDICATOR for example...
    Option 1 (no INDICATOR variable in specification)
    CREATE OR REPLACE FUNCTION MyTest(Lang IN VARCHAR2, Form IN VARCHAR2) RETURN VARCHAR2
    AS EXTERNAL
    LIBRARY Lemma_Ext
    NAME "MyExtTest"
    LANGUAGE "C"
    WITH CONTEXT
    PARAMETERS(CONTEXT,Lang string, Form string, RETURN string)
    and it works OK with it's "C" prototype
    +char * MyExtTest (char Lang, char Form);+
    Option 2 (with INDICATOR, doesn't work):
    CREATE OR REPLACE FUNCTION MyTest(Lang IN VARCHAR2, Form IN VARCHAR2) RETURN VARCHAR2
    AS EXTERNAL
    LIBRARY Lemma_Ext
    NAME "MyExtTest"
    LANGUAGE "C"
    WITH CONTEXT
    PARAMETERS(CONTEXT, Lang string, Form string, RETURN INDICATOR short, RETURN string)
    and it is not works with following "C" prototype:
    +char * MyExtTest (char Lang, char Form, short *return_ind);+
    Option 3 (with INDICATOR, works!):
    CREATE OR REPLACE FUNCTION MyTest(Lang IN VARCHAR2, Form IN VARCHAR2) RETURN VARCHAR2
    AS EXTERNAL
    LIBRARY Lemma_Ext
    NAME "MyExtTest"
    LANGUAGE "C"
    WITH CONTEXT
    PARAMETERS(CONTEXT, Lang string, Form string, RETURN INDICATOR short)
    and it works like a charm with the same "C" prototype as in the Option 2:
    +char * MyExtTest (char Lang, char Form, short *return_ind);+
    Just removing "RETURN string" was a correct solution!
    And I found a couple of examples of successful external functions (with extra parameters) from Metalink. All these examples don't contain RETURN <type> in function specification.
    So, where is the source of misunderstanding?
    Regards,
    Andrew.

    Hi AndresG,
    Are you using O2A cartridges or not?
    If you are not, by default, the fulfillment states are in the following location --
    a) external fulfillment state -- /ControlData/Functions/<Function>/orderItem/ExternalFulfillmentState
    b) composite fulfillment state (i.e. output of FS composition) -- /ControlData/OrderItem/OrderItemFulfillmentState for order items, and /ControlData/OrderFulfillmentState for overall order.
    Note that mapped fulfillment states are not persisted.
    These defaults are configurable by creating FulfillmentStateModule.xquery file, and have XML catalog include the file. In fact, this is how O2A cartridges override these defaults; the fulfillment states are stored in /OrderLifeCycleManagement area.
    Yes, you can update the external fulfillment state during function execution -- in your automation of the function, simply return the external fulfillment state in your xquery automator.
    To send composite fulfillment state to CRM, yes, you need to create a Data Changed Event Notification -- set it to trigger by Composite Fulfillment State change.
    Cheers,
    Daniel Ho
    OSM Product Management

  • Declaration for va-args type external functions

    Does Oracle 9i support external functions of similar type to decode() and if so what is the syntax for defining the package wrapper.
    If not is there a means of evaluating a regexpr passed as an array element (other than by writing an interface to the regexp C library?

    Michael Reiche wrote:
    Java invocation from XQuery in ALDSP is supported.Therefore, as ALSB uses the same XQuery implementation as ALDSP, I should be
    able to use it in ALSB. Especially, that link to ALDSP XQuery documentation I
    have found in ALSB documentation. Does anyone know how to do this?
    Best regards,
    Dawid Duda

  • How to use external timebase for Two Edge Separation measurement with PCIe 6351

    Hi
    I am working with PCIe 6351 x series DAQ card.
    counter measurements.
    Here i need to measure the time/no edges between two edges. Falling to Raising of two signals.
    I got the measurement with internal time base.
    here i need to synchronize the measurements with external clock from the external setup.
    so i need to use that external clock,timebase for the counters.
    Any solution please..
    Regards,
    Hari

    First, the VI you mention is NOT for STC timer/counters. Therefore, it won't work.
    If you want to get the time interval between two edges, you want to use the Functions -> Data Acquisition -> Counter -> Count Events or Time VI. This will do the function you are looking for.
    Mark

  • How to use this FUNCTION VIEW_MAINTENANCE

    hi
    i create a table zxxxx and set Data Browser/Table View Maint:
                                                  Display/Maintenance Allowed.
    so i want to use the function of "VIEW_MAINTENANCE" to update and create new
    inforation the TABLE.
    but i don't know VIEW_MAINTENANCE which of parameter meaning.
    and how to control it.
    who can give demo show.
        CALL FUNCTION 'VIEW_MAINTENANCE'
          EXPORTING
            VIEW_ACTION               = 'S' "DISPLAY
            VIEW_NAME                 = W_VIEWNAME "W_TABNAME
          TABLES
            X_HEADER                  = L_VIMDESC
            X_NAMTAB                  = L_VIMNAMTAB
            DBA_SELLIST               = L_VIMSELLIST
            EXCL_CUA_FUNCT            = L_VIMEXCLFUN.
    what meaning and availability value : EXCL_CUA_FUNCT-FUCNTION ,
    how to use         X_HEADER  
            X_NAMTAB           
            DBA_SELLIST       these parameter.
    thank you very much.

    Please check doucmentation maintained for FM - VIEW_MAINTENANCE.
    CUA functions to be deactivated dynamically
    At runtime, the table EXCL_CUA_FUNCT must contain all those functions which are not to be callable in data processing , i.e. which are to be dynamically deactivated in the CUA interface at runtime. This is useful, e.g. for the following functions whose handling in cluster maintenance is ambiguous:
    - 'ANZG' --> switch from 'Change' to 'Display' mode,
    makes no sense in a maintenance cluster
    - 'AEND' --> switch from 'Display' to 'Change' mode
    makes no sense in a display cluster
    - 'xxxx' --> other functions at the callers discretion.
    The table must have the structure VIMEXCLFUN, as follows:
    FUNCTION(4) TYPE C, ---> contains the function codes to be deactivated dynamically
    MESSAGE(3) TYPE C. ---> online help auxiliary field (not yet supported)
    Return ->
    CUA functions to be deactivated dynamically
    Database Access Selection Conditions The table DBA_SELLIST contains the database access selection conditions. The following fields must be filled:
    Field name Contents       
    NEGATION NOT, if the condition is to be negated       
    SPACE otherwise       
    VIEWFIELD name of the field to which the condition is to apply       
    OPERATOR logical operator of the condition (e.g. 'EQ', 'NE',...)       
    VALUE comparison value of the condition in external format       
    AND_OR AND, if the next line of the condition is to be linked       
    to the current line by logical AND       
    OR , if the next line of the condition is to be linked       
    to the current line by logical OR       
    SPACE, if no further line follows       
    DDIC S, if the view field in DD is flagged as a subset field       
    (PM = 'S')       
    SPACE otherwise       
    TABIX Index of the view field in the view nametab     
    Notes:
    1. Valid operators are: (see also ABAP doc.)
    EQ - equals
    NE - not equal to
    GT - greater than
    GE - greater than or equal to
    LT - less than
    LE - less than or equal to
    CA - only for strings: contains at least one character of the comparison string
    CN - only for strings: negation of CA
    CO - only for strings: contains only characters from the comparison string
    NA - only for strings: negation of CO
    CP - only for strings: contains the pattern in the comparison string
    NP - only for strings: negation of CP
    CS - only for strings: contains the string in the comparison string
    NS - only for strings: negation of CS
    LK - like the LIKE operator in a SELECT ... WHERE clause
    2. The function module does not (yet) check whether the selection conditions passed here are compatible with any conditions in the Data Dictionary view definition. The caller must ensure that this is the case.
    Return ->
    Database Access Selection Conditions

  • OSB11g - using Concatenation function in report key - Xpath

    Hi,
    I am trying to use Concatenation function on Report key Xpath. For that i am using Following Xpath Expressions But this expressions not valid when trying to validate. But same expressions are valid under different scenarios in OSB.
    1.fn:concat(./bpel:process/bpel:input, ./bpel:process/bpel:input)
    error msg(when validate):_
    error: XPath expression invalid, not a selection: declare namespace jca = 'http://www.bea.
    com/wli/sb/transports/jca'; declare namespace wsp = 'http://schemas.xmlsoap.org/ws/2004/09/policy';
    declare namespace jms = 'http://www.bea.com/wli/sb/transports/jms'; declare namespace tp = 'http:
    //www.bea.com/wli/sb/transports'; declare namespace wsa05 = 'http://www.w3.
    org/2005/08/addressing'; declare namespace jejb = 'http://www.bea.com/wli/sb/transports/jejb';
    declare namespace xs = 'http://www.w3.org/2001/XMLSchema'; declare namespace sftp = 'http://www.
    bea.com/wli/sb/transports/sftp'; declare namespace flow = 'http://www.bea.com/alsb/flow/transport';
    declare namespace soap-env = 'http://schemas.xmlsoap.org/soap/envelope/'; declare namespace wsu
    = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'; declare
    namespace dsp = 'http://www.bea.com/dsp/transport/sb'; declare namespace ejb = 'http://www.bea.
    com/wli/sb/transports/ejb'; declare namespace bpel = 'http://xmlns.oracle.
    com/Bpel_Actvities/Assign_Activity/BPELProcess'; declare namespace wsa = 'http://schemas.xmlsoap.
    org/ws/2004/08/addressing'; declare namespace bpel-10g = 'http://www.bea.
    com/wli/sb/transports/bpel10g'; declare namespace tuxedo = 'http://www.bea.
    com/wli/sb/transports/tuxedo'; declare namespace file = 'http://www.bea.com/wli/sb/transports/file';
    declare namespace ctx = 'http://www.bea.com/wli/sb/context'; declare namespace fn = 'http://www.w3.
    org/2004/07/xpath-functions'; declare namespace soap12-enc = 'http://www.w3.org/2003/05/soap-
    encoding'; declare namespace soap12-env = 'http://www.w3.org/2003/05/soap-envelope'; declare
    namespace fn-bea = 'http://www.bea.com/xquery/xquery-functions'; declare namespace mq = 'http:
    //www.bea.com/wli/sb/transports/mq'; declare namespace ws = 'http://www.bea.
    com/wli/sb/transports/ws'; declare namespace http = 'http://www.bea.com/wli/sb/transports/http';
    declare namespace soa-direct = 'http://www.bea.com/wli/sb/transports/soa'; declare namespace email
    = 'http://www.bea.com/wli/sb/transports/email'; declare namespace sb = 'http://www.bea.
    com/wli/sb/transports/sb'; declare namespace ftp = 'http://www.bea.com/wli/sb/transports/ftp';
    declare namespace xsd = 'http://www.w3.org/2001/XMLSchema'; declare namespace soap-enc = 'http:
    //schemas.xmlsoap.org/soap/encoding/'; declare namespace xsi = 'http://www.w3.
    org/2001/XMLSchema-instance'; fn:concat(./bpel:process/bpel:input, ./bpel:process/bpel:input)
    2. op:concatenate(./bpel:process/bpel:input, ./bpel:process/bpel:input)
    While using this Xpath expression validation is sucessfull but concatenation operation is not working when checked in the message reports under operations tab.
    Can any one help me on this.
    Thanks in advance.

    can you try assign concatenated value to some xml element first, like
    assign : <value>{fn:concat(a,b)}</value> to e.g. value
    and then report key ./text() in variable $value
    Edited by: AigarsP on Jun 12, 2012 4:12 AM

  • How to get Database functions into xquery/XSLT in OSB 12c

    Hello All,
    How to make use of  functions orcl:sequence-next-val and orcl:query-database in xslt/xquery in OSB 12c.
    I need to do the below logic in xslt/xquery and used it in replace activity . But in OSB 12c I don't see these function. Request to provide me the solution to do it in OSB.
    XSLT in SOA
    <xsl:when test="/ns0:CreateEvent/ns0:Header/header:SourceName != &quot;&quot;">
                <ns1:googleEventSourceId>
                  <xsl:value-of select="orcl:query-database(concat(&quot;select google_event_source_id from enterprise.google_event_source where google_event_source=&quot;,&quot;'&quot;,/ns0:CreateEvent/ns0:Header/header:SourceName,&quot;'&quot;),false(),false(),&quot;jdbc/PRDatasource&quot;)"/>
                </ns1:googleEventSourceId>
              </xsl:when>
    <ns1:googleMapEventId>
              <xsl:value-of select="orcl:sequence-next-val(&quot;enterprise.google_map_event_seq&quot;,&quot;jdbc/PRDatasource&quot;)"/>
            </ns1:googleMapEventId>
    please see below code is just part of my transformation.
    Regards,
    TJ.

    bump

  • How to use external procedures in OWB Mapping

    Hi,
    Does anyone have an exmple of using external procdures in Mapping.
    Thanks
    mandi

    Hi Mandi,
    you can use Public and self created external Procedures/Functions in a Mapping.
    You can integrate them in Expressions, e.g.
    or use them as Post or Premapping in a Mapping.
    It´s simple, just play a bit :-)
    Only on a few Things you´ve to watch:
    Every external Objects you want to use in a Mapping must be known in the Metadatas.
    If you create a Mapping under the User scott,(e.g.), and you want to use
    an external Procedures/Functions from the User Tiger,(e.g.), you must make sure
    that theres a connection between these two Schematas.
    For such things you can create a Connector in the Control Center.
    Regards
    Lone

  • Problem in the External Function returned data RAW

    Hi,
    I have a problem, I would want to create an external function in Oracle 10g, than given in input a data RAW it gives back in output the value in format raw.
    I have realized such function through language C.
    these are the prototypes of the function
    ORACLE side:
    CREATE OR REPLACE FUNCTION F_RETURN_RAW (inputText IN RAW)
    RETURN RAW                                                                  -- I do not know to return RAW !!!
    AS LANGUAGE C
    NAME "f_Return_Raw"
    LIBRARY C_Library_DAN
    PARAMETERS
    (inputText RAW,
    inputText INDICATOR,
    inputText LENGTH);
    C side:
    ???? f_Return_Raw(CK_BYTE_PTR in_Text,
    short *in_TextInd,
    int *in_TextLen)
    I do not know what to put in place of ????
    someone can help me with some example?
    thanks to all!
    Regards
    Daniele

    Hello I had already seen the package UTL_RAW,
    in particular is CAST_TO_VARCHAR2 that CAST_TO_RAW,
    but these me are useful Oracle side,
    my problem are to give back to Oracle, from side C, one RAW.
    Perhaps it is not possible to give back a RAW directly?
    or I have more probably not understood your suggestion!
    I would want to create a function that he concurred me to make that
    insert into table_example values(f_Return_Raw(RAW_INPUT))
    that the function gives back RAW directly
    Regards
    Daniele

Maybe you are looking for