Using decode in where clause with user defined function

Hi,
I have a below query which is failing as the function in the decode taking all cust_account_id as input parameter instead of the one which satisfies the condition in the inner query.So please provide a solution how can i pass only the selected one.
SELECT hca.cust_account_id
FROM hz_cust_accounts hca
WHERE hca.org_id=FND_PROFILE.value('ORG_ID')
AND hca.cust_account_id = (SELECT DISTINCT hcasa.cust_account_id
FROM hz_cust_acct_sites_all hcasa
WHERE hcasa.cust_account_id =hca.cust_account_id
AND hca.org_id = hcasa.org_id)
AND DECODE (hca.status , 'A', xx_ar_cust_audit_pkg.get_ship_to_order_type(hca.cust_account_id)) IS NOT NULL
Thanks,
Abhilash

I'm having to guess without access to your tables, but I think changing the IN to a join should produce the same results. The JOIN should be evaluated before applying the WHERE clause, so this may resolve your problem.
SELECT hca.cust_account_id
FROM   hz_cust_accounts hca
       INNER JOIN hz_cust_acct_sites_all hcasa
       ON    hcasa.cust_account_id = hca.cust_account_id
       AND   hca.org_id = hcasa.org_id
WHERE  hca.org_id = FND_PROFILE.value('ORG_ID')
AND    DECODE (hca.status , 'A', xx_ar_cust_audit_pkg.get_ship_to_order_type(hca.cust_account_id)) IS NOT NULLAlternately, you could next part of the query and break the DECODE into the parent so it is evaluated after the inner query. This is likely uglier from a performance standpoint, though:
SELECT cust_account_id
FROM
SELECT hca.cust_account_id, hca.status
FROM   hz_cust_accounts hca
WHERE  hca.org_id=FND_PROFILE.value('ORG_ID')
AND    hca.cust_account_id = (SELECT DISTINCT hcasa.cust_account_id
                              FROM   hz_cust_acct_sites_all hcasa
                              WHERE  hcasa.cust_account_id =hca.cust_account_id
                              AND    hca.org_id = hcasa.org_id)
WHERE DECODE (status , 'A', xx_ar_cust_audit_pkg.get_ship_to_order_type(cust_account_id)) IS NOT NULL;

Similar Messages

  • Can i use Decode in Where clause

    Hi,
    Can i use Decode in Where clause Please Do the need full on the same.
    Thanks,
    Sanjeev.

    set serveroutput on
    DECLARE
    posn  PLS_INTEGER := 0;
    empid PLS_INTEGER := 178;
    x     NUMBER;
    BEGIN
      SELECT NVL(SUM(ah.quantity * ah.saleprice * ap.payoutpct), 0)
      INTO x
      FROM accessoryhistory ah, payoutpercentage ap,
      sku s, store st
      WHERE empid = DECODE(posn,
                              0, st.areadir,
                              1, st.areamgr,
                              2, NVL(st.storemgr1, st.storemgr2),
                              3, NVL(st.asstmgr1, NVL(st.asstmgr2,
                           st.asstmgr3)))
      AND ah.statustype IN ('ACT', 'DEA')
      AND ah.store = st.store
      AND s.dbid = ah.dbid
      AND s.sku = ah.sku
      AND ap.productgroup = s.productgroup
      AND ap.position = posn;
      dbms_output.put_line(x);
    END;
    /http://psoug.org/reference/decode_case.html

  • Problem with user-defined functions in XQuery String

    hello
    i've a problem with user-defined functions in XQuery String
    details are here (the code is not Human-readable via forum's embedded editor ?? strange)
    http://docs.google.com/Doc?id=ddqwddsr_21c96d9x
    thanks !!

    See
    michaels>  select xmlquery('declare function local:test_function($namecmp as xs:string?, $inputtype as xs:string?) as xs:string?      
                        return {$inputtype}
                     local:test_function("1","2")' returning content) o from dual
    Error at line 5
    ORA-19114: error during parsing the XQuery expression:
    LPX-00801: XQuery syntax error at '{'
    3                       return {$inputtype}
    -                              ^
    michaels>  select xmlquery('declare function local:test_function($namecmp as xs:string?, $inputtype as xs:string?) as xs:string?      
                        $inputtype
                     local:test_function("1","2")' returning content) o from dual
    O   
    2   
    1 row selected.

  • Urgent Help Needed - Associating Statistics with User-Defined Functions

    Hello,
    We have an appication uses cost-based optimizer and uses a lot of TO_DATE and SYSDATE calls in FROM and WHERE clauses. For certain reasons, every call to TO_DATE and SYSDATE has been replaced by MY_TO_DATE and MY_SYSDATE respectively (which in turn call built-in functions). However, cost based optimizer is behaving strangely, which is understanble, based on the lack of user-defined functions statistics. I am under the impression that I should use something like:
    ASSOCIATE STATISTICS WITH FUNCTIONS my_to_date DEFAULT SELECTIVITY ?;
    ASSOCIATE STATISTICS WITH FUNCTIONS my_to_date COST (?,?,?);
    ASSOCIATE STATISTICS WITH FUNCTIONS my_sysdate DEFAULT SELECTIVITY ?;
    ASSOCIATE STATISTICS WITH FUNCTIONS my_sysdate COST (?,?,?);
    but what should the values (?) be?. I guess I want to replicate TO_DATE and SYSDATE values, but how would I find out what they are? Thanks in advance...
    P.S. I am also looking for workarounds (I cannot create a synonym for TO_DATE right?), so any help is welcome!!!

    Hi emmalou69 ,
    You told your actual parameter is
    5, 5, 7.3 and 'z'
    so change your method like
    public static int test(int x, int y, double d, char ch)
    because 5 - int; 7.3- float or double; z is char.
    your method returns
    public static int.
    so you should return only int variable. but in your code you mentioned double. it's not correct.
    The original code should look like
    public class rubbish
         public static void main(String args[]){
              rubbish f = new rubbish();
              f.test(5, 5, 7.3 ,'z');
         public static int test(int x, int y, double d, char ch)
              int value;
              x = 5;
              y = 5;
              d= 7.3;
              ch = 'z';
              value =((int) d + x + y + ch);
              System.out.println( x + ch + d + y);
              return value;
    }//here int value of z is 122.
    and int(7.3) is 7
    so 7+5+5+122 = 139.3
    but value =((int) d + x + y + ch); returns 139. because you convert double to int that is 7.3 to 7
    If it is useful, rate me duke dollars,
    Thanks

  • Need help with user defined function

    Hello SDN,
    I need some help with a user-defined function. My source message contains multiple
    generic records (1000 char string), and my target message is 1 header record,
    then multiple generic records.  See description of source and target messages below:
    Source:
      GenericRecordTable 1..unbounded
        Row (1000 char string)
    Target:
      Field1 (char5)
      Field2 (char5)
      Field3 (char5)
      IT_Data
        GenericRecordTable 1..unbounded
          Row (1000 char string)
    Basically, what I need to do in my user defined funtion is to map the first record
    in my source record to the 3 header fields, then map all of the rest of the records
    (starting from line 2) into the GenericRecordTable.
    Can someone please help me with the code for the user defined function(s) for this
    mapping?
    Thank you.

    hi,
    Activities
    1. To create a new user-defined function, in the data-flow editor, choose Create New Function (This
    graphic is explained in the accompanying text), which is located on the lower left-hand side of the
    screen. In the menu, choose Simple Function or Advanced Function.
    2. In the window that appears, specify the attributes of the new function:
    Name
    Technical name of the function. The name is displayed in the function chooser and on the data-flow
    object.
    Description
    Description of how the function is used.
    Cache
    Function type (see above)
    Argument Count
    In this table, you specify the number of input values the function can process, and name them. All
    functions are of type String.
    3. In the window that appears, you can create Java source code:
    a. You can import Java packages to your methods from the Imports input field, by specifying them
    separated by a comma or semi-colon:
    You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since
    all message mappings require these packages and therefore import them. You should be able to
    access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the
    package under Import. In other words, you do not have to import it as an archive into the Integration
    Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the
    SAP Logging Service (see also: Runtime Environment (Java-Mappings)).
    In addition to the standard packages, you can also specify Java packages that you have imported as
    archives and that are located in the same, or in an underlying software component version as the
    message mapping.
    b. Create your Java source text in the editor window or copy source text from another editor.
    4. Confirm with Save and Close.
    5. User-defined functions are limited to the message mapping in which you created the function. To
    save the new function, save the message mapping.
    6. To test the function, use the test environment.
    The new function is now visible in the User-Defined function category. When you select this category,
    a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the
    function to the data-flow editor, choose the arrow next to the button and select from the list box
    displayed.
    http://help.sap.com/saphelp_nw04/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm
    http://java.sun.com/j2se/1.5.0/docs/api/
    /people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi
    /people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    UDF -
    http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
    Regards

  • How to use pl/sql code as ODI user defined function

    Hi All,
    i have a pl/sql code and i want to create ODI user defined function using this code .
    please find the pl/sql code below:
    ============================
    declare
    v_no_of_duplicate_rec number := 0;
    begin
    select count(*)
    into v_no_of_duplicate_rec
    from ( select 1
    from temp_pre_selections
    group by svb_number, selection_id
    having count(*) > 1);
    if v_no_of_duplicate_rec = 0 then
    return 'N';
    else
    return 'Y';
    end if;
    end if;
    ==========================
    please help me how to achieve the same .
    Thanks
    Vinod

    2 ways:
    a. implement logic in odi function directly: getCount, Oracle implementation:
    select case count(1) when 0 then 'N' else 'Y' end
    from hr.employees
    when you use this function to refresh a variable, the refresh statement should only be getCount, you shoueld not write select getCount from dual, otherwise it will become
    select select .... from ... from dual
    b. if your logic is complex, I suggest to write function directly in your database, then call this function in your ODI function
    eg:
    CREATE OR REPLACE FUNCTION hr.test RETURN varchar2 IS
    tmpVar NUMBER;
    BEGIN
    select count(1) into tmpVar from hr.employees;
    if tmpVar=0 then
    return 'N';
    else
    return 'Y';
    end if;
    END test;
    then create a ODI function, Oracle implementation is
    hr.test
    in your variable refresh statement, you can write select getCount from dual
    if you use the odi function in other locations expect for refreshing variable, the idea is similar

  • Using decode in where clause

    Hi all
    We can use decode function in the Select columns as well as Group by Columns as well as Having Clause
    Can we use decode function in the where clause also. If yes can u give small sample
    Suresh Bansal

    ""DECODE in the WHERE clause"
    http://psoug.org/reference/decode_case.html
      WHERE empid = DECODE(posn,
                              0, st.areadir,
                              1, st.areamgr,
                              2, NVL(st.storemgr1, st.storemgr2),
                              3, NVL(st.asstmgr1, NVL(st.asstmgr2,
                           st.asstmgr3)))

  • Using Decode in where clause in free hand sql

    Hi,
        I want to use decode in free hand sql.
    for eg : this is a where condition
    Outlet_Lookup.City  =  @variable('Enter City')
    Requirement :
    if we put the user prompt as "Enter City and % for all cities"
    and the user enters % then the data display should be all cities or else it shld be the specific city entered in the prmpt..
    Can we do that using Decode statement,
    I have tried
    Outlet_Lookup.City  =  Decode(@variable('Enter City'),'%',Outlet_Lookup.City,(@variable('Enter City')))
    This is not working....
    Pls guide on the same..
    Thanks.

    Hi Mathieu,
            Thanks for the solution,
    I tried the following
    ((Outlet_Lookup.City  =  @variable('Enter City or % for All') or @variable('Enter City or % for All')='%'))
    This is working fine....
    Thanks
    Regards,
    Aparna.

  • Problem with User-defined function

    Does anyone know how to make the user-efined functionto return a object. We know how to run a java class within cal script and pass the result to that java class. However, what we need is to be able to return the result in the form of a java class within the calling class. This is because we are calling the calscript within ejb and the ejb that executes the calscript needs to be able to get the result back.In our case, we are using webLogic EJB to execute a EDS calScript function. We don't know how to have the object created by EDS to be passed back to the EJB.Any insight will be greatly appreciated.Thanks,Anne

    Hi Anoop,
    The query and function work fine for me. What does the line and column information in the error point to?
    John

  • Decode in where claus with date comparasion

    hi
    i m using this query can we compare date in decode function in where claue if yes how
    SELECT PPA.START_DATE,
    PPA.END_DATE
    FROM pa_project_assignments PPA,
    PA_CONTROL_ITEMS PCI
    WHERE DECODE(PPA.START_DATE < PCI.ATTRIBUTE1,PCI.ATTRIBUTE1,PPA.START_DATE) BETWEEN (PCI.ATTRIBUTE1) AND (PCI.DATE_REQUIRED)
    AND PPA.END_DATE BETWEEN (PCI.ATTRIBUTE1) AND( PCI.DATE_REQUIRED)
    AND PPA.PROJECT_ID=PCI.PROJECT_ID

    This works.
    SELECT * FROM emp
    WHERE
    CASE WHEN hiredate < SYSDATE THEN
    hiredate
    ELSE SYSDATE
    END BETWEEN SYSDATE-10000 AND SYSDATEIn your CASE
    SELECT PPA.START_DATE,
    PPA.END_DATE
    FROM pa_project_assignments PPA,
    PA_CONTROL_ITEMS PCI
    WHERE
    case when PPA.START_DATE < PCI.ATTRIBUTE1 then
    PCI.ATTRIBUTE1
    else
    PPA.START_DATE
    end  BETWEEN PCI.ATTRIBUTE1 AND PCI.DATE_REQUIRED
    AND PPA.END_DATE BETWEEN  PCI.ATTRIBUTE1 AND PCI.DATE_REQUIRED
    AND PPA.PROJECT_ID=PCI.PROJECT_IDCheers!!!
    Bhushan

  • Base64 decode with user defined function called from xslt

    I have an xml document which has a segment containing a b64 encoded attachment.
    I would like to decode the attachment as i map it.
    I would think this could be done by using a java function of some kind being called from the xslt however i have very limited experience in this and none in how to code the decoding.
    Anyone have an example ?
    Cheers
    Jon

    >
    Jon Vaugan wrote:
    > I have an xml document which has a segment containing a b64 encoded attachment.
    > I would like to decode the attachment as i map it.
    >
    > I would think this could be done by using a java function of some kind being called from the xslt however i have very limited experience in this and none in how to code the decoding.
    >
    > Anyone have an example ?
    >
    > Cheers
    > Jon
    yes SDN seems to have an example for you....it may not exactly solve your problem...but yes it not irrelevant.....you just need to do some R&D
    /people/farooq.farooqui3/blog/2008/05/22/decode-base64-incoming-encoded-information-in-sap-xipi-using-java-mapping
    Regards,
    Abhishek

  • Help with User Defined Function

    Hi
    I want to code a UDF which comapres an array that contains "X" or empty values,with an array which contains only "X" and return a boolean array with boolean arguments (true/false)
    I tried using the exisiting functions but I didnt find something relevant
    Thx,Shai

    Func 1: public void ChkForX(String[] a,ResultList result,Container container){
    int flag = 0;
    int count = 0;
    for (int i = 0; i<a.length; i++)
    if(a<i>equals("X"))
    {flag = 0;     }
    else
    {flag = 1;
    count = count + 1;
    if(count > 0)
    result.addValue("1");
    else
    {result.addValue("0");
    Func 2:
    public void ChkSpaces(String[] a,ResultList result,Container container){
    int flag = 0;
    int count = 0;
    for (int i = 0; i<a.length; i++)
    if(a<i>equals(" "))
    {flag = 0;     }
    else
    {flag = 1;
    count = count + 1;
    if(count > 0)
    result.addValue("2");
    else
    {result.addValue("3");
    Kinda use both these functions with the same input then further build your logic ... but still i dont think you will get a array as output using UDF

  • Problem with user defined function in XQUERY

    Hi,
    I have a file in which I store XQUERY. My java program reads this file and executes the xquery
    and output the result. I have a working XQUERY in a file, which is something like :
    <feed>
    let $entries := for $x in collection('/path/to/atomStore.bdbxml')/entry[matches(id,'
    .entry')]
    order by $x/updated descending
    return <entry xmlns="http://www.w3.org/2005/Atom">{$x/id,$x/title,$x/published,$x/updated,$x/link}
    </entry>
    let $latest := fn:subsequence($entries, 1, 10)
    for $f in $latest return $f
    </feed>
    After adding the following simple function(I'm not calling it anywhere for the time being),
    I'm getting an error
    com.sleepycat.dbxml.XmlException: Error: Error in XQuery expression:
    Unrecognized character 'a' (0x61) [err:XPST0003], line 33, column 2, errcode = XPATH_PARSER_ERROR
    declare function xml:convertdate($date as xs:integer) as xs:string
    let $months := ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec")
    let $month := $months[$date]
    return $month
    I couldn't find any error with the function syntax. Anyone has any idea?
    Regards,
    Anoop

    Hi Anoop,
    The query and function work fine for me. What does the line and column information in the error point to?
    John

  • Dynamic where clause with loop statement

    Hi all,
    is it possible to use a dynamic where clause with a loop statement?
    Can you please advise me, how the syntax needs to be?
    Thanks for your suggestions,
    kind regards, Kathrin!

    Hi Kathrin,
               If u are in ECC 6.0, please go through the code...
              REPORT  zdynamic_select.
    TYPES:
      BEGIN OF ty_sales,
        vbeln  TYPE vbak-vbeln,            " Sales document
        posnr  TYPE vbap-posnr,            " Sales document item
        matnr  TYPE vbap-matnr,            " Material number
        arktx  TYPE vbap-arktx,            " Short text for sales order item
        kwmeng TYPE vbap-kwmeng,           " Order quantity
        vkorg TYPE vbak-vkorg,             " Sales organization
        kunnr TYPE vbak-kunnr,             " Sold-to party
        netwr TYPE vbak-netwr,             " Net Value of the Sales Order
      END OF ty_sales.
    DATA :
      gt_sales TYPE STANDARD TABLE OF ty_sales,
      wa_sales TYPE ty_sales.
    DATA: ob_select TYPE REF TO cl_rs_where.
    DATA: ob_from   TYPE REF TO cl_rs_where.
    DATA: ob_where  TYPE REF TO cl_rs_where,
          gv_source TYPE abapsource.
    START-OF-SELECTION.
    *Step 1 : Prepare the select fields.
      PERFORM zf_build_select.
    *Step 2 : Build the from clause for the select
      PERFORM zf_build_from.
    *Step 3 : Build the where clause for the select
      PERFORM zf_build_where.
    *Step 4 : Execute the dynamic select
      SELECT (ob_select->n_t_where)
          FROM (ob_from->n_t_where)
            INTO CORRESPONDING FIELDS OF TABLE gt_sales
            WHERE (ob_where->n_t_where).
      LOOP AT gt_sales INTO wa_sales.
        WRITE :   /5 wa_sales-vbeln,
                  15 wa_sales-vkorg,
                  20 wa_sales-kunnr,
                  40 wa_sales-netwr,
                  50 wa_sales-posnr,
                  60 wa_sales-matnr,
                  70 wa_sales-arktx,
                  90 wa_sales-kwmeng.
      ENDLOOP.
    *&      Form  zf_build_select
    FORM zf_build_select .
      CREATE OBJECT ob_select.
    *Build the table name/field name combination
    *Add Sales order header fields
      CLEAR gv_source.
      CALL METHOD cl_rs_where=>build_tabname_fieldname
        EXPORTING
          i_tabname   = 'VBAK'
          i_fieldname = 'VBELN'
          i_sign      = '~'
        IMPORTING
          e_combined  = gv_source.
    *Add the where line
      CALL METHOD ob_select->add_line
        EXPORTING
          i_line = gv_source.
      CLEAR gv_source.
      CALL METHOD cl_rs_where=>build_tabname_fieldname
        EXPORTING
          i_tabname   = 'VBAK'
          i_fieldname = 'VKORG'
          i_sign      = '~'
        IMPORTING
          e_combined  = gv_source.
    *Add the where line
      CALL METHOD ob_select->add_line
        EXPORTING
          i_line = gv_source.
      CLEAR gv_source.
      CALL METHOD cl_rs_where=>build_tabname_fieldname
        EXPORTING
          i_tabname   = 'VBAK'
          i_fieldname = 'KUNNR'
          i_sign      = '~'
        IMPORTING
          e_combined  = gv_source.
    *Add the where line
      CALL METHOD ob_select->add_line
        EXPORTING
          i_line = gv_source.
      CLEAR gv_source.
      CALL METHOD cl_rs_where=>build_tabname_fieldname
        EXPORTING
          i_tabname   = 'VBAK'
          i_fieldname = 'NETWR'
          i_sign      = '~'
        IMPORTING
          e_combined  = gv_source.
    *Add the where line
      CALL METHOD ob_select->add_line
        EXPORTING
          i_line = gv_source.
    *Add Sales order item fields
      CALL METHOD cl_rs_where=>build_tabname_fieldname
        EXPORTING
          i_tabname   = 'VBAP'
          i_fieldname = 'POSNR'
          i_sign      = '~'
        IMPORTING
          e_combined  = gv_source.
    *Add the where line
      CALL METHOD ob_select->add_line
        EXPORTING
          i_line = gv_source.
      CLEAR gv_source.
      CALL METHOD cl_rs_where=>build_tabname_fieldname
        EXPORTING
          i_tabname   = 'VBAP'
          i_fieldname = 'MATNR'
          i_sign      = '~'
        IMPORTING
          e_combined  = gv_source.
    *Add the where line
      CALL METHOD ob_select->add_line
        EXPORTING
          i_line = gv_source.
      CLEAR gv_source.
      CALL METHOD cl_rs_where=>build_tabname_fieldname
        EXPORTING
          i_tabname   = 'VBAP'
          i_fieldname = 'ARKTX'
          i_sign      = '~'
        IMPORTING
          e_combined  = gv_source.
    *Add the where line
      CALL METHOD ob_select->add_line
        EXPORTING
          i_line = gv_source.
      CLEAR gv_source.
      CALL METHOD cl_rs_where=>build_tabname_fieldname
        EXPORTING
          i_tabname   = 'VBAP'
          i_fieldname = 'KWMENG'
          i_sign      = '~'
        IMPORTING
          e_combined  = gv_source.
    *Add the where line
      CALL METHOD ob_select->add_line
        EXPORTING
          i_line = gv_source.
    ENDFORM.                    " zf_build_select
    *&      Form  zf_build_from
    FORM zf_build_from .
      CREATE OBJECT ob_from.
    *Add opening bracket
      CALL METHOD ob_from->add_opening_bracket
      CLEAR gv_source.
    *Add the join condition.This can be made
    *fully dynamic as per your requirement
      gv_source = 'VBAK AS VBAK INNER JOIN VBAP AS VBAP'.
    *Add the where line
      CALL METHOD ob_from->add_line
        EXPORTING
          i_line = gv_source.
      CLEAR gv_source.
    *Add the join condition.This can be made
    *fully dynamic as per your requirement
      gv_source = 'ON VBAKVBELN = VBAPVBELN'.
    *Add the where line
      CALL METHOD ob_from->add_line
        EXPORTING
          i_line = gv_source.
    *Add the closing bracket
      CALL METHOD ob_from->add_closing_bracket
    ENDFORM.                    " zf_build_from
    *&      Form  zf_build_where
    FORM zf_build_where .
      DATA :
      lv_field TYPE REF TO data,
      lv_field_low TYPE REF TO data,
      lv_field_high TYPE REF TO data.
      CREATE OBJECT ob_where.
    *Add the field VBELN : Sales Document
    *Use this method if you want to assign a single value to a field
    *Set the value for VBELN : Sales Document Number
    CALL METHOD ob_where->add_field
       EXPORTING
         i_fieldnm  = 'VBAK~VBELN'
         i_operator = '='
         i_intlen   = 10
         i_datatp   = 'CHAR'
       IMPORTING
         e_r_field  = lv_field.
    CALL METHOD ob_where->set_value_for_field
       EXPORTING
         i_fieldnm = 'VBAK~VBELN'
         i_value   = '0000120020'.
    *Use this method if you want to assign a range of values
    *Set a range for the Sales Document number
      CALL METHOD ob_where->add_field_between_2values
        EXPORTING
          i_fieldnm      = 'VBAK~VBELN'
          i_intlen       = 10
          i_datatp       = 'CHAR'
        IMPORTING
          e_r_field_low  = lv_field_low
          e_r_field_high = lv_field_high.
      CALL METHOD ob_where->set_2values_for_field
        EXPORTING
          i_fieldnm    = 'VBAK~VBELN'
          i_value_low  = '0000120020'
          i_value_high = '0000120067'.
    *Set the 'AND' Clause
      CALL METHOD ob_where->add_and.
    *Add the field MATNR : Material
      CALL METHOD ob_where->add_field
        EXPORTING
          i_fieldnm  = 'MATNR'
          i_operator = '='
          i_intlen   = 18
          i_datatp   = 'CHAR'
        IMPORTING
          e_r_field  = lv_field.
    *Set the value for the Material field
      CALL METHOD ob_where->set_value_for_field
        EXPORTING
          i_fieldnm = 'MATNR'
          i_value   = '000000000050111000'.
    *Set the 'AND' Clause
      CALL METHOD ob_where->add_and
    *Add the field VKORG
      CALL METHOD ob_where->add_field
        EXPORTING
          i_fieldnm  = 'VKORG'
          i_operator = '='
          i_intlen   = 4
          i_datatp   = 'CHAR'
        IMPORTING
          e_r_field  = lv_field.
    *Set the value for VKORG : Sales Organization
      CALL METHOD ob_where->set_value_for_field
        EXPORTING
          i_fieldnm = 'VKORG'
          i_value   = 'GMUS'.
    ENDFORM.                    " zf_build_where

  • Are Sql functions different from user defined functions ?

    Hello,
    SQL functions are built into Oracle Database and are available for use in various appropriate SQL statements. Do not >confuse SQL functions with user-defined functions written in PL/SQL.according to first paragraph of this document Sql functions are different from user defined functions . How is that ?
    Is they really differ from each other ?

    bootstrap wrote:
    If you don't know what compilation is, please use Wikipedia or other online resources.I know what is compilation . But i was confused whether those sql functions are compiled in my machine when i install Oracle Database in my machine or they are pre-compiled .
    As you said these Sql functions are pre-compiled , it is clear now that they are pre-compiled platform dependent code .
    Can you provide actual source code of any SQL function , say SUM function .
    I want to see it, how they have defined . Eagerly waiting for any reply. please help .
    Edited by: bootstrap on Aug 19, 2011 11:50 AMYou can ask oracle if they give you their code. I doubt they will. However if you want to write you own user-defined aggregation function, there are examples in the documentation how to do that.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_packages.htm#i1008575
    Edited by: Sven W. on Aug 19, 2011 9:24 AM

Maybe you are looking for

  • New beta features: share to Twitter, Facebook, & Pinterest

    We've added a few beta sharing features for you to try out.  Now, you can share to Facebook, Twitter, and Pinterest directly from theme details. We have created a special link to give you access to new features (new feature link)--without this link y

  • How to create inputstream to a .jar

    i want to make an inputstream that points to the jar file my main class was executed from. this dosent seem to work: InputStream is = CypherIO.class.getResourceAsStream("jar.jar");i guess a "resource" is something inside a jar... also it would be nic

  • The idoc number changes when I execute it in WE19

    Hi, I am executing an inbound idoc with message type ORDERS in WE19. I then choose the relevant inbound function module, choose the foreground processing and then execute in debug mode. The control then goes inside the function module. I then check t

  • Hi expert, UDF HIDING PROBLEM

    Hi all, my code below i m getting proble when i hiding udf . i done using this code but application got slow because each time this event called.    If pVal.FormType = "-142" Then                 Try                     If BubbleEvent = True Then    

  • How to reverse Pen-tilt display/cursor?

    Took a screen shot of a Youtube vid, then took a screen shot of the screen shot. Essentially, I don't have that grey box anymore. I dropped the pen and it swapped it to the cursor. So now I see the tilt and brush shape instead of the circle and the g