Creation of VO : no parameters allowed in where clause ?

Hello,
I'm trying to define a VO with an existing SQL statement having several parameters.
I tested the statement and it's correct.
When I create the VO and define the bind variables, it says OK.
But when I want to try the application module I got an error "*java.sql.SQLException: Missing IN or OUT parameter at index:: 1*"
The query looks like this :
select table1.start start_date,
       decode(:param1,0,table2.label,null) label
  from schema1.table1, schema1.table2
where table1.code=:param2
   and table1.code=table2.codeThe problem does not occur if I remove the line containing the param2 but then the query is invalid.

I created a sample using the departments table:
SELECT Departments.DEPARTMENT_ID,
       Departments.DEPARTMENT_NAME,
       Departments.LOCATION_ID,
       Departments.MANAGER_ID
FROM DEPARTMENTS Departments
WHERE  Departments.Department_id=:inDepartmentIdinDepartmentId is updateable and required
In DepartmentsImpl I overriden executeQuery() like this:
@Override
    public void executeQuery() {
        System.out.println("DepartmentId variable: "+getViewObject().ensureVariableManager().getVariableValue("inDepartmentId"));
        super.executeQuery();
    }It always prints the variable I enter when I execute and has no problem.
I cannot think of any reason this would not work for you...
Make sure that the variables are of the correct type.
I would also suggest deleting and recreating your VO just in case that something is corrupt in your XML.
Gabriel.

Similar Messages

  • Passing Multiple Parameters to a Where clause

    Dear All,
    Using Crystal 11.5 on XP workstations, communicating with a SQL database.
    I want to allow users to input two or three or four Meeting codes -- text fields about 10 characters -- into a Crystal multiple parameter field.  Then I want to use those names to access data for each meeting, grouping on the meeting . . .
    WHERE meeting.name = 'MeetingCode1' or meeting.name = 'MeetingCode2 or meeting.name = 'MeetingCode3'
    I've tried just using "IN" with the parameter and that won't work for this -- though it seems to get data for cvross tabs which is puzzling.  I've tried using the JOIN function to parse out the data and build the WHERE clause and have been unsuccessful (but if you tell me that should work, I can go at it again that way -- all kinds of issues there comparing it to Crystal's SQL view.
    Any thoughts about how to tackle this would be greatly appreciated.
    Sincerely,
    Ridge (in New Joisey)

    I just tested this again -- going very slowly and very carefully -- and it seems to be working setting the
    { table.field} IN
    for both numeric and string values.
    Sorry for wasting bandwidth.
    R

  • Derive found flag in SQL with where clause using TABLE(CAST function

    Dear All,
    Stored procedure listEmployees
    ==========================
    CREATE OR REPLACE TYPE STRING_ARRAY AS VARRAY(8000) OF VARCHAR2(15);
    empIdList STRING_ARRAY
    countriesList STRING_ARRAY
    SELECT EMP_ID, EMP_COUNTRY, EMP_NAME, FOUND_FLAG_
    FROM EMPLOYEE WHERE
    EMP_ID IN
    (SELECT * FROM TABLE(CAST(empIdList AS STRING_ARRAY))
    AND EMP_COUNTRY IN
    (SELECT * FROM TABLE(CAST(countriesList AS STRING_ARRAY))
    =================
    I have a stored procedure which lists the employees using above simple query.
    Here I am using table CAST function to find the list of employees in one go
    instead of looping through each and every employee
    Everything fine until requirements forced me to get the FOUND_FLAG as well.
    Now I wanted derive the FOUND_FLAG by using rownum, rowid, decode functions
    but I was not successful
    Can you please suggest if there is any intelligent way to say weather the
    row is found for given parameters in the where clause?
    If not I may have to loop through each set of empIdList, countriesList
    and find the values individually just to set a flag. In this approach I can’t use
    the TABLE CAST function which is efficient I suppose.
    Note that query STRING_ARRAY is an VARRAY. It is very big in size and this procedure
    suppose to handle large sets of data.
    Thanks In advance
    Regards
    Charan
    Edited by: kmcharan on 03-Dec-2009 09:55
    Edited by: kmcharan on 03-Dec-2009 09:55

    If your query returns results, you have found them... so your "FOUND" flag might be a constant,...

  • Using multiple values in a where clause, for values only known at runtime

    Dear all
    I am creating a PL/SQL program which returns multiple rows of data but only where it meets a set id values that a user has previously chosen. The id values are stored in an associative array and are chosen by a user in the preceding procedure at run time.
    I know all the table and column names in advance. The only things I don't know are the exact number of ids selected from the id column and what their values will be. This will only be known at runtime. When the procedure is run by the user it prints multiple rows of data to a web browser.
    I have been reading the following posting, which I understand to a large extent, Query for multiple value search But I cannot seem to figure out how I would apply it to my work as I am dealing with multiple rows and a cursor.
    The code as I have currently written it is wrong because I get an error not found message in my web browser. I think the var_user_chosen_map_list_ids in the for cursor loop could be the problem. I am using the variable_user_chosen_map_list_ids to store all the id values from my associatative array as a string. Which I modified from the code that vidyadhars posted in the other thread.
    Should I be creating a OPEN FOR ref cursor and if so where would I put my associative array into it? At the moment I take the value, turning it into a string and IN part in the WHERE clause holds the string, allowing the WHERE clause to read all the values from it. I would expect the where clause to read everything in the string as 1 complete string of VARCHAR2 data but this would not be the case if this part of the code at least was correct. The code is as follows:
    --Global variable section contains:
    var_user_chosen_map_list_ids VARCHAR2(32767);
    PROCEDURE PROCMAPSEARCH (par_user_chosen_map_list_ids PKG_ARR_MAPS.ARR_MAP_LIST)
    IS
    CURSOR cur_map_search (par_user_chosen_map_list_ids IN NUMBER)
    IS
    SELECT MI.map_date
           MT.map_title,
    FROM map_info MI,
         map_title MT,
    WHERE MI.map_title_id = MT.map_title_id
    AND MI.map_publication_id IN
    (var_user_chosen_map_list_ids);
    var_map_list_to_compare VARCHAR2(32767) := '';
    var_exe_imm_map VARCHAR2(32767);
    BEGIN
    FOR rec_user_chosen_map_list_ids IN 1 .. par_user_chosen_map_list_ids.count
    LOOP
       var_user_chosen_map_list_ids := var_user_chosen_map_list_ids ||
       '''' ||
       par_user_chosen_map_list_ids(rec_user_chosen_map_list_ids) ||
    END LOOP;
    var_user_chosen_map_list_ids := substr(var_user_chosen_map_list_ids,
                                            1,
                                            length(var_user_chosen_map_list_ids)-1);
    var_exe_imm_map := 'FOR rec_search_entered_details IN cur_map_search
    LOOP
    htp.print('Map date: ' || cur_map_search.map_date || ' Map title: ' || cur_map_search.map_title)
    END LOOP;';
    END PROCMAPSEARCH;EXECUTE IMMEDIATE var_exe_imm_map;
    I would be grateful of any comments or advice.
    Kind regards
    Tim

    I would like to thank everyone for their kind help.
    I have now successfully converted my code for use with dynamic SQL. Part of my problem was getting the concept confused a little, especially as I could get everything work in a static cursor, including variables, as long as they did not contain multiple values. I have learnt that dynamic sql runs the complete select statement at runtime. However even with this I was getting concepts confused. For example I was including variables and the terminator; inside my select string, where as these should be outside it. For example the following is wrong:
         TABLE (sys.dbms_debug_vc2coll(par_user_chosen_map_list_ids))....
    AND MI.map_publication_id = column_value;';Where as the following is correct:
         TABLE (sys.dbms_debug_vc2coll('||par_user_chosen_map_list_ids||'))....
    AND MI.map_publication_id = column_value';PL/SQL is inserting the values and then running the select statement, as opposed to running the select statement with the variables and then accessing the values stored in those variables. Once I resolved that it worked. My revised code is as follows:
    --Global variable section contains:
    var_user_chosen_map_list_ids VARCHAR2(32767);
    var_details VARCHAR(32767);
    PROCEDURE PROCMAPSEARCH (par_user_chosen_map_list_ids PKG_ARR_MAPS.ARR_MAP_LIST)
    IS
    BEGIN
    FOR rec_user_chosen_map_list_ids IN 1 .. par_user_chosen_map_list_ids.count
    LOOP
       var_user_chosen_map_list_ids := var_user_chosen_map_list_ids ||
       '''' ||
       par_user_chosen_map_list_ids(rec_user_chosen_map_list_ids) ||
    END LOOP;
    var_user_chosen_map_list_ids := substr(var_user_chosen_map_list_ids,
                                            1,
                                            length(var_user_chosen_map_list_ids)-1);
    var_details := FUNCMAPDATAFIND (var_user_chosen_map_list_ids);
    htp.print(var_details);
    END PROCMAPSEARCH;
    FUNCTION FUNCMAPDETAILS (par_user_chosen_map_list_ids IN VARCHAR2(32767)
    RETURN VARCHAR2
    AS
    TYPE cur_type_map_search IS REF CURSOR;
    cur_map_search cur_type_map_search;
    var_map_date NUMBER(4);
    var_map_title VARCHAR2(32767);
    begin:
    OPEN cur_map_search FOR
    'SELECT MI.map_date,
           MT.map_title
    FROM map_info MI,
         map_title MT,
         TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_map_list_ids || '))
    WHERE MI.map_title_id = MT.map_title_id
    AND MI.map_publication_id = column_value';
    LOOP
    FETCH cur_map_compare INTO
    var_map_date,
    var_map_title;
    var_details := var_details || 'Map date: '||
                        var_map_date ||
                        'Map title: ' ||
                        var_map_title;
    EXIT WHEN cur_map_compare%NOTFOUND;
    END LOOP;
    RETURN var_details;
    END FUNCMAPDETAILS;Kind regards
    Tim

  • Ref cursor argument in where clause

    Env: ORCL 9.2
    I have a func that uses the parameters in a where clause and returns a ref cursor as result. That works fine.
    I want to create an overloaded func that replaces one argument with a ref cursor. (instead of accepting a single value as an argument I want to accept multiple values) Can you specify the ref cursor in a where clause with out looping through the cursor ?
    CURRENT
    func(arg1,arg2,arg3) returns ref cursor
    is
    select blah from sometable s
    where s.a = arg1
    and s.b = arg2
    and s.c = arg3
    NEW
    func(ref_cur_arg1,arg2,arg3) returns ref cursor
    is
    select blah from sometable s
    where s.a = ref_cur_arg1
    and s.b = arg2
    and s.c = arg3
    is there something like:
    where s.a in (loop fetch ref_cur_arg1 end loop)
    thx

    Thanks Rich,
    That's pretty much what I came up with:
    FUNCTION f_bond_price_w_bb_stat (
                                  p_id_ref gtyp_instr_id_ref,
                                  p_price_srce bond_price.PRICE_SRCE%type,
                                  p_price_type bond_price.PRICE_TYPE%type,
                                  p_price_date bond_price.PRICE_DATE%type)
    RETURN gtyp_bondprice_w_bb_stat_rfc
    IS
    lv_bondprice_rfc gtyp_bondprice_w_bb_stat_rfc;
    TYPE ARRAY1 IS TABLE OF instr_ext_id_map.ext_id_value%TYPE INDEX BY BINARY_INTEGER;
    t_instr_id ARRAY1;
    instr_ids INSTR_EXT_ID_T := INSTR_EXT_ID_T();
    BEGIN
         --suck the contents of the ref cursor into a local virtual tmp table
    FETCH p_id_ref BULK COLLECT INTO t_instr_id;
    FOR i IN 1..t_instr_id.COUNT LOOP
         instr_ids.extend;
              instr_ids(instr_ids.count) := t_instr_id(i);
    END LOOP;
    CLOSE p_id_ref;
    OPEN lv_bondprice_rfc FOR
    SELECT
    bs.ID_ISIN,
    bs.TICKER,
    bs.CPN,
    bs.MATURITY,
    round(months_between(bs.MATURITY,sysdate)/12,1),
    bs.ISSUER_INDUSTRY,
    bs.INDUSTRY_SECTOR,
    FROM bond_price b,
    instr_ext_id_map ext,
    etl.mdy_ratingstatic mrs,
         etl.mdy_extid mxid,
         etl.bloomberg_static bs
    WHERE b.INSTR_ID = ext.instr_id
    AND bs.ID_ISIN(+) = ext.ext_id_value
    AND bs.ID_ISIN = mxid.EXTIDVALUE(+)
    AND mrs.MOODYDEBTNUM(+) = mxid.MOODYDEBTNUM
    AND ext.ext_id_value in (select * from TABLE (cast (instr_ids AS INSTR_EXT_ID_T) ))
    AND b.PRICE_SRCE = p_price_srce
    AND b.PRICE_TYPE = p_price_type
    AND b.PRICE_DATE = p_price_date
    RETURN lv_bondprice_rfc;
    END f_bond_price_w_bb_stat;

  • [Solved] Named Bind Variables at Runtime - SQL WHERE clause issue

    Hey 'all,
    I've been having this issue today with a Search page using Named Bind Variables at Runtime for the search parameters for the WHERE clause in the view objects SQL.
    I've got everything working except for a clearing method which I've created so that the user can clear the current WHERE clause from the SQL statment and set it as 1=2 (so that it doesn't do a blind query on load).
    The method can clear and set the WHERE clause to 1=2 only when there is already one there.
    Below are the methods: (located in my view object class)
    public void findInvoiceById(Number invoiceId){
        setWhereClause("invoice_id = :P_INVOICE_ID");
        defineNamedWhereClauseParam("P_INVOICE_ID",null,null);
        setNamedWhereClauseParam("P_INVOICE_ID",invoiceId);
        executeQuery();
    public void clearCriteria(){
        setWhereClause("1=2");
        removeNamedWhereClauseParam("P_INVOICE_ID");
        executeQuery();
    }The error which I get is the following - this happens when the button is pressed twice in a row, or when no query has been passed previously.
    1. JBO-29000: Unexpected exception caught: oracle.jbo.NoDefException, msg=JBO-25058: Definition P_INVOICE_ID of type Variable not found in SupplierInvoicesView1
    2. JBO-25058: Definition P_INVOICE_ID of type Variable not found in SupplierInvoicesView1
    Any help with this would be greatly appreciated!
    Cheers,

    Hi Bonnie,
    we have it working ok, but still feel that there is room for improvement in the design.
    For us the key factors are:
    Pages based on the same view object that can be queried multiple ways.
    We don't want to put design time bind variables in because it limits the use of the VO
    We don't wan't multiple VO's with different where clauses.
    The page is displaying the same table columns and fields, but the where clause must be dynamic.
    We only want to query on the search field entered (some of our tables are massive)
    TopLink named queries are really what we are after, but we don't want to forgo all the other ADF BC functionality. The only examples of ViewCriteria in the developer guide had literals in the where clause and no bind variables. The View Criteria may still be an option, but it appeared quite complex compaired to directly adding and removing bind variables at runtime.
    a couple of footnotes:
    the following methods are used to clear the runtime variables prior to reusing the VO (thanks to John Stegman for the pointer on the exception handler):
        public void clearBindVariable(String bindVariableName){
            try
                removeNamedWhereClauseParam(bindVariableName);
            catch (NoDefException e)
        public void clearBindVariables(){
            clearBindVariable("P_INVOICE_ID");
            clearBindVariable("P_INVOICE_NUM");
            clearBindVariable("P_SUPPLIER_NAME");
            clearBindVariable("P_INVOICE_DATE_FROM");
            clearBindVariable("P_INVOICE_DATE_TO");
            clearBindVariable("P_SUPPLIER_NUMBER");
        }We are using 1=1 and 1=2 in the where clause to supress blind querying. 1=2 is applied when ever we are not explicitely searching for something. We had a problem with using the refresh condition ${adfFacesContext.postback == true} which I posted about here:
    executeQuery called twice using ${adfFacesContext.postback == true}
    Would still gladly hear other ideas on a better reuse design.
    regards,
    Brenden

  • Urgent: "where" clause for polling database Adapter

    Hi
    I am creating a database Polling (logical delete OPEN to CLOSED) adapter that polls a table for records which have a "SCHEDULED" date field.
    The Polling Adapter should pick up those records where the status is OPEN and SCHEDULED<=SYSDATE.
    DB Adapter wizard does not allows this where clause(SCHEDULED<=SYSDATE) to be set; so i tried modifying the Toplink SQL with custom SQL. But it does not works. Please suggest a workaround.
    Please help.
    Thanks
    Debashis

    Hi
    Please refer ..\SOA_HOME\bpel\samples\tutorials\122.DBAdapter\advanced\polling\PollingPureSQLOtherTableInsert Readme.txt and Note 873991.1 How To Use Custom SQL To Poll Database Tables Via Database Adapter LogicalDeletePollingStrategy.
    This works.
    thanks
    --debashis                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Delivery Note to Subcontract creation error "Essential transfer parameters

    Hi
    I am facing issue in return delivey
    Delivery Note to Subcontract creation error "Essential transfer parameters are missing in record:000001".
    Could you please let me know the casue of this error and where exactly i can see error.
    Regards
    vikcy

    Hi Vicky,
                   Check If the Customer number(Plant) has been maintained in the vendor master record control data and the vendor should also be maintained in the customer master data. Once you maintain this system determines the shipping point based on the  customer master and the shipping data missing. Kindly try delivering after maintaining these and let me know If you need any more information on this.
    Regards
    Ram Pedarla

  • Using Parameters in SQL-Query not only in where clauses

    Hi,
    I try to use Publisher parameters in the SQL Query from a Data Set.
    All of them have default values.
    So far, this is no problem, unless I try to use such a parameter value as an ordinary attribute value:
    >
    select
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."BETR_TEIL"
                                            else :pv_some_Text end                                                                  as Betr_Teil,
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM"
                                            else :pv_some_Text end                                                        as Suva_Nr,
         case when (:pv_Group = 'no') then "DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH"
                                            else sum("DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") end      as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in (:pv_nim100)
         fetch first 65001 rows ONLY
    >
    The parameters 'pv_Group' and 'pv_nim100' are working fine. (when or where clauses)
    The parameter 'pv_some_Text' unfortunately not. (simple literals)
    When I try to validate the above SQL, I get the following Error:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46033] Datatype: 25 is not supported.
    </font>
    After use a cast function:
    >
    else CAST(:pv_some_Text AS CHARACTER)
    >
    I get this ERROR:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 19002] Incorrect use of parameters. The parameters used in CAST cannot be resolved without ambiguity.
    </font>
    We use OBIEE 11.1.1.6.4 on a Win64-System.
    Thank's for any help.

    Hi Alex,
    let's leave away any unnecessary details.
    This is the SQL, inserted in the window 'Edit Data Set' of BIP Data Model:
    >
    select
         '--1'     as Betr_Teil,
         '--2'      as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    Everything is fine when I click OK, the script goes back to the metadata.
    Let's try this script with bind values in ORACLE SQL Developer.
    This SQL is the physical part, found in the OBIEE-Log (Log level 5), except the bind values. Therefore we find, in the where clause, the join. In the logical sql, we don't have to join, because it's handled in the Common Enterprise Information Model (CEIM)
    >
    with
    sawith0 as
    select
    sum(t39617.ris_vollbesch) as c1
    from
    dm15d_betriebsteil t39455,
    dm15k_ris_fakten_pro_btt_jhr t39617
    where
    t39455.id_betriebsteil = t39617.id_betriebsteil
    and t39455.suva_nr_form = '122-4.4'
    select
    d1.c1 as c1,
    d1.c2 as c2,
    d1.c3 as c3
    from
    select
    :pv_some_text as c1,
    :pv_some_text as c2,
    sum(d1.c1) as c3
    from
    sawith0 d1
    d1
    where
    rownum <= 65001
    >
    This SQL works fine, even with bind values for 'pv_some_text'.
    But, when using the following SQL in the BIP Data Model:
    >
    select
         :pv_Text as Betr_Teil,
         :pv_Text as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    The following ERROR occurs:
    <font color="red">java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46008] Internal error: File server\Query\Optimizer\ServiceInterfaceMgr\Utility\Src\SQOIUTypeVisitor.cpp, line 643.</font>
    In my opinion, either I use a wrong syntax, or BIP has a problem with parsing the script.
    Thank you for your most welcome help.

  • Dynamic Where clause in 4.6C [Literals allowed but not variables]

    Good afternoon-
    We have a dynamic select statement that works perfectly in 4.7 ext 2, but is causing a short dump in 4.6C. The error in the short dump says:
    The current ABAP/4 program attempted to execute an ABAP/4 Open SQL       
    statement containing a WHERE condition of the form WHERE (itab) or       
    WHERE ... AND (itab). The part of the WHERE condition specified at       
    runtime in the internal table itab contains an invalid                   
    value "HDR_COMP_CODE". Literals are allowed as values, but not variables.
    HDR_COMP_CODE is in incoming parameter to the function module that is calling this code. It is of type BKPF-BUKRS.
    Here is the code:
    DATA: BEGIN OF L_WHERE_CLAUSE OCCURS 0,
            TEXT_LINE(60) TYPE C,
      END OF L_WHERE_CLAUSE.
      CLEAR L_WHERE_CLAUSE.
      IF NOT HDR_COMP_CODE IS INITIAL.
        SELECT SINGLE KTOPL
        INTO LV_KTOPL
        FROM T001
        WHERE BUKRS = HDR_COMP_CODE.
        L_WHERE_CLAUSE = 'B~BUKRS = HDR_COMP_CODE'.
        APPEND L_WHERE_CLAUSE.
        CLEAR  L_WHERE_CLAUSE.
        L_WHERE_CLAUSE = 'AND'.
        APPEND L_WHERE_CLAUSE.
        CLEAR  L_WHERE_CLAUSE.
        L_WHERE_CLAUSE = 'T~KTOPL = LV_KTOPL'.
        APPEND L_WHERE_CLAUSE.
        CLEAR  L_WHERE_CLAUSE.
        L_WHERE_CLAUSE = 'AND'.
        APPEND L_WHERE_CLAUSE.
        CLEAR  L_WHERE_CLAUSE.
      ENDIF.
      L_WHERE_CLAUSE = 'T~SPRAS = SY-LANGU'.
      APPEND L_WHERE_CLAUSE.
      CLEAR  L_WHERE_CLAUSE.
      SELECT BSAKNR TTXT50
      INTO (LT_GL_ACCOUNT_DATA-GL_ACCOUNT, LT_GL_ACCOUNT_DATA-DESCRIPTION)
      FROM  SKB1 AS B INNER JOIN SKAT AS T
         ON TSAKNR = BSAKNR
      WHERE (L_WHERE_CLAUSE).
        APPEND LT_GL_ACCOUNT_DATA.
        CLEAR  LT_GL_ACCOUNT_DATA.
      ENDSELECT.
    This EXACT query works in 4.7, has anyone run into this, or can they tell me why I might be getting the error?
    Thanks,
    Andy

    Well, in this case, unless I'm missing something,  you do not requre a dynamic WHERE clause.  You can use RANGES instead.
    report zrich_0001.
    *DATA: BEGIN OF L_WHERE_CLAUSE OCCURS 0,
    *TEXT_LINE(60) TYPE C,
    *END OF L_WHERE_CLAUSE.
    ranges: r_bukrs for t001-bukrs.
    ranges: r_ktopl for t001-ktopl.
    *CLEAR L_WHERE_CLAUSE.
    IF NOT HDR_COMP_CODE IS INITIAL.
    clear r_bukrs. refresh r_bukrs.
    r_bukrs-sign = 'I'.
    r_bukrs-option = 'EQ'.
    r_bukrs-low = hdr_comp_code.
    append r_bukrs.
    SELECT SINGLE KTOPL
    INTO LV_KTOPL
    FROM T001
    WHERE BUKRS = HDR_COMP_CODE.
    clear r_ktopl. refresh r_ktopl.
    r_ktopl-sign = 'I'.
    r_ktopl-option = 'EQ'.
    r_ktopl-low = lv_ktopl.
    append r_ktopl.
    *L_WHERE_CLAUSE = 'B~BUKRS = HDR_COMP_CODE'.
    *APPEND L_WHERE_CLAUSE.
    *CLEAR L_WHERE_CLAUSE.
    *L_WHERE_CLAUSE = 'AND'.
    *APPEND L_WHERE_CLAUSE.
    *CLEAR L_WHERE_CLAUSE.
    *L_WHERE_CLAUSE = 'T~KTOPL = LV_KTOPL'.
    *APPEND L_WHERE_CLAUSE.
    *CLEAR L_WHERE_CLAUSE.
    *L_WHERE_CLAUSE = 'AND'.
    *APPEND L_WHERE_CLAUSE.
    *CLEAR L_WHERE_CLAUSE.
    ENDIF.
    *L_WHERE_CLAUSE = 'T~SPRAS = SY-LANGU'.
    *APPEND L_WHERE_CLAUSE.
    *CLEAR L_WHERE_CLAUSE.
    SELECT B~SAKNR T~TXT50
    INTO (LT_GL_ACCOUNT_DATA-GL_ACCOUNT, LT_GL_ACCOUNT_DATA-DESCRIPTION)
    FROM SKB1 AS B INNER JOIN SKAT AS T
    ON T~SAKNR = B~SAKNR
    WHERE  b~bukrs in r_bukrs
      and  t~ktopl in r_ktopl.
    APPEND LT_GL_ACCOUNT_DATA.
    CLEAR LT_GL_ACCOUNT_DATA.
    ENDSELECT.
    Regards,
    Rich Heilman

  • NVL in where clause not working with UNIX parameters

    Apparently this in a where clause does not work in UNIX scripts...
    .... and trans_date between to_date('&1','YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('&2','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    ERROR at line 14:
    ORA-01858: a non-numeric character was found where a numeric was expected
    How do I get around a null in UNIX? This works fine if both parameters are populated. Thanks.

    Jason ORCL wrote:
    Apparently this in a where clause does not work in UNIX scripts...
    .... and trans_date between to_date('&1','YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('&2','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    ERROR at line 14:
    ORA-01858: a non-numeric character was found where a numeric was expected
    How do I get around a null in UNIX? This works fine if both parameters are populated. Thanks.it's nothing to do with unix at all - your date value doesn't match the format mask that you've entered:
    '31-DEC-4712' doesn't map to 'YYYY/MM/DD HH24:MI:SS' in any universe unfortunately.

  • Parameters in where clause

    Hi,
    Can we use lexical parameter in the where clause to select multiple values using IN operator. I am using IN operator to match to values in the where cluase, so do I need to use a lexical parameter or bind parameter for it.
    Please help.

    Thanks Rainer,
    I've tried it but it's giving me an error. Please look at my sql and let me know if there is any syntax error.
    SELECT COLA , COLB, COUNT(*)
    FROM TABL_A
    WHERE COLA LIKE :P_NAME
    AND COLB IN &P_SIGN
    GROUP BY 1,2
    This query gives me an error: invalid use of lexical paramter. However, I have defined it in user parameters as character.
    When I give parameter with qoutation like '&P_SIGN' then it accept the query but still don't match all the values in the IN operator.
    thanks.

  • Binding parameters to dynamic VO with PL/SQL API call with no where clause

    Hi all,
    I am required to change exisiting queries to queries with "bind" parameters. Some of our VOs are dynamic and with PL/SQL api calls like below:
    String stmtStr = "selectXXX_API_UTILS.chk_urg_since_last_prg("
    + projectId + "," + PPCId + ",'XYZ_TASKS'," + taskId+ ")"
    +" from dual ";
    ViewObject tmpVO = transaction.createViewObjectFromQueryStmt(stmtStr);
    In this regard, I am unsure how to bind the PPCId and taskId parameters to the VO. setWhereClauseParams() would not work here as there is now where clause.
    Thanks in advance,
    Srini

    In case of preparedStatement, we mention bind parameters to be passed using "?". Then we pass paramters sequencially.
    But in the your case following is enough:
    int projectId = 100 ; (hardcoding values for example)
    int taskId = 500 ;
    String stmtStr = "selectXXX_API_UTILS.chk_urg_since_last_prg("
    + projectId + "," + PPCId + ",'XYZ_TASKS'," + taskId+ ")"
    +" from dual ";
    -Anand

  • Query in the where clause is not allowed

    Hi all,
    I have a table m_vehicle that stores 1 or more than 1 rows of data for each person. But the partner's schema requires that 0 or 1 vehicle license plate data be sent with the xml file. I have the following nested select statement inside a bigger one and it does not work,
    select xmlelement("VehicleLicensePlate",
         (case when mv.lic_plate_state is not null then
              xmlelement("PlateState", mv.lic_plate_state)
         end), -- end of plate state
         (case when mv.lic_plate_no is not null then
              xmlelement("PlateNumber", xmlelement("ID", mv.lic_plate_no))
         end),
         (case when mv.lic_plate_year is not null then
              xmlelement("PlateExpiryYear", mv.lic_plate_year)                                                  
         end)
         ).extract('/*')
    from m_vehicle mv where mv.mni_id = 1083650
    and mv.seq_no = (select max(mv2.seq_no) from m_vehicle mv2
    where mv2.mni_id = mv.mni_id) and mv.lic_plate_no is not null
    But it works when I run it alone and gets the latest row for the person. It does not work either if I join this table with other tables. My root element select is from dual because I have to supply lots of SOAP and other artifacts in the xml. Is it because I have this root select from dual that the query in the where clause does not work? How do I make it work so that I get 0 or one row only from the table? My solution was to write a function that returns each part of the license plate data using dymanic sql and call it in the xmlelement function. It works but I would like to use plain sql instead.
    Thanks.
    Ben

    By the way, the error I get is this,
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00216: invalid character 3 (0x3)
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 111
    Ben

  • How to pass parameters to function in  where clause....

    I have a select statement like this
    SELECT XX_AIR_TICKET_EMP_BAL(:P2) from dual
    is it possible to pass to variable p2 from where clause
    like
    SELECT XX_AIR_TICKET_EMP_BAL(:P2) from dual
    where :p2 = :p1
    user can enter only in p1 so that p2 should get passed.
    Reson for this wierd requirement:In Oracle apps i cant use bind variable in select clause value set..? please ignore this reason if u are not in oracle apps...
    Tell me the solution..
    Is there any way...
    setting some env variavle aor anything

    [email protected] wrote:
    I have a select statement like this
    SELECT XX_AIR_TICKET_EMP_BAL(:P2) from dualWhy a SELECT statement? This calls the SQL engine. The function is PL/SQL. This now needs the SQL engine to context switch to the PL engine. The PL engine runs and returns a value (across memory boundaries) to the SQL engine. The SQL engine now needs to return that value as part of the output from a SQL cursor.
    Why do all this? Surely it is a lot easier and better for performance to call the PL engine directly using an anonymous PL block. E.g.
    begin
      :P3 := XX_AIR_TICKET_EMP_BAL(:P2);
    end;
    is it possible to pass to variable p2 from where clause
    like
    SELECT XX_AIR_TICKET_EMP_BAL(:P2) from dual
    where :p2 = :p1Why?
    This can be done as part of the PL block as follows:
    begin
      if :P2 = :P1 then
        :P3 :=  XX_AIR_TICKET_EMP_BAL(:P2);
      end if;
    end;But then why construct conditional statements dynamically?
    It would be a lot easier to have a new function that does the condition, e.g.
    create or replace function getAirTicket( p1 number, p2 number ) return number is
    begin
      if p1 = p2 then
        return( XX_AIR_TICKET_EMP_BAL(p2) );
      else
       return( null );
      end if;
    end;

Maybe you are looking for

  • Best quality dvd

    Hi i have a panasonic hdc-sd5 camera and am very happy with the quality it shoots at, and also how easy it is to use with 08. However i want to know how can i get the best results(ie HD) onto a dvd to share my movies? Thanks jc

  • XHTML page with current PHP form - client wants Coldfusion integration...

    I have never worked with  Coldfusion before and I have no idea what it involves. The form is setup  with PHP right now, however, the client uses Coldfusion and would  prefer the form to be set up to integrate with it. I dont even know where to start!

  • How to manually add music from your library

    I'm attempting to manually add an album in my library onto my iphone library, but it won't let me. On the phone summary it only has "Manually manage videos" and not music, and on the Music tab it only allows me to add voice memos. Can anyone suggest

  • Problem with playback Device please help

    When im talking to someone on skype i cant listen to anything else but the skype call. If im listening to music or watching a video and i try to call somebody it says problem with payback device and won't let me call or answer a call. What do i do?

  • CS Extension Builder

    Is the CS Extension Builder included with creative cloud and if so where does one get it from?