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;

Similar Messages

  • How can we use DECODE function in where clause.

    Hi Guys,
    I have to use DECODE function in where clause.
    like below
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and decode(code, 'a','approved')
    in this manner its not accepting?
    Can any one help me on this or any other aproach?
    Thanks
    -LKR

    >
    I am looking for to decode the actual db value something in different for my report.
    like if A then Accepted
    elseif R then Rejected
    elseif D then Denied
    these conditions I have to check in where clause.
    >
    what are you trying to do?
    may be you are looking for
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and
       (decode(:code, 'A','Accepted') = <table_column>
        or
        decode(:code, 'R','Rejected') = <table_column>
       or
        decode(:code, 'D','Denied') = <table_column>
       )

  • How to pass parameters to function module

    Hello,
    Can someone suggest how to pass parameter values to BAPI function module from a .NET client? I am using the BAPI_PO_GETDETAILS module and want to pass required parameters to get the item details. Also, please let me know which table should I refer to when retrieving the result. I am using sap .net connector 3.0.
    Thanks in advance

    Hi unosino,
    at http://www.se80.co.uk/sapfms/b/bapi/bapi_po_getdetail.htm you can see, that you have to pass po_header and po_address to the function.
    You can do that with the nco3 like this:
    IRfcFunction rfcFunction = destination.Repository.CreateFunction("BAPI_PO_GETDETAILS");
    rfcFunction.SetValue("po_header", /* your value */);
    rfcFunction.SetValue("po_address", /* your value */);
    rfcFunction.Invoke(destination);
    kind regards
    christian
    Edited by: chrislind on Nov 11, 2011 2:47 PM

  • How to pass parameters into Function module : CLOI_PUT_SIGN_IN_FRONT

    Hello friends,
    I am displaying values ie, amounts in the screen using write statements here i have to display the
    sign left side , i am using  Function module   'CLOI_PUT_SIGN_IN_FRONT'    
    Does anybody help me - How to pass paramter into this Function module.
    Regards,
    Phaneendra

    If you look to the code of the function module, you can see it is condensing the value.
    I would make a copy of this function, and remove the condense lines to give the result you want.
      data: text1(1) type c.
      search value for '-'.
      if sy-subrc = 0 and sy-fdpos <> 0.
        split value at '-' into value text1.
        condense value.
        concatenate '-' value into value.
      else.
        condense value.
      endif.

  • How to pass the parameter in the where clause of the select statement

    Hi All,
    Iam getting one of the value from the Input otd and using this value i need to query one of the tables in oracle database and selected the table using the oracle eway otd like shown below .
    otdRISKBLOCK_1.getRISKBLOCK().select() .
    where clause in side the select takes a string parameter as Iam getting the string parameter from the input otd and passing this to where clause by creating a string literal after deployment it is giving an error saying "ORA-00920: invalid relational operator".
    can any one throw some input on this .
    Thanks in Advance
    Srikanth

    You will see this error if the search condition was entered with an invalid or missing relational operator.
    You need to include a valid relational operator such as
      =, !=, ^=, <>, >, <, >=, <=, ALL, ANY, [NOT] BETWEEN, EXISTS, [NOT] IN, IS [NOT] NULL, or [NOT] LIKE in the condition. in the sql statement.
    Can you throw some more light on how are you designing your project?

  • How to pass the values to the WHERE-Clause in JClient ADF?

    Hi all,
    my JDeveloper Version is 10.1.2.0.0 (Build 1811)
    I need something like this:
    A Form with a Filter-Panel, and the Table-Panel EMP.
    In Filter:
    1. DEPTNO as ComboBox with values from the DEPT table (not static values). The ComboBox should contain all deptno's from DEPT and one NULL value too, so the user can be able to select this NULL-value and get all employees from all depatments.
    2. TextField Job - not the database field - not required. The user should be able to enter in this field any JOB and get the Employees for selected deptno (or for all departments by selecting NULL-value) in combobox with the needed job. When the user does not enter anything in the TextField then he should get all Employees from the department from combobox.
    In Table-Panel:
    JTable for EMP.
    What I try to do:
    1. Create an Application Workspace with "Java Application [default]" as Application Template.
    2. For Model-Package: New -> Business Components -> Business Components from Tables
    3. On the "Entity Objects from Tables"-page of wizard I shuttle DEPT and EMP from available to selected.
    4. On the "Updatable View Objects from Entity Objects"-page I shuttle the both view objects from availabe to selected.
    5. On the "Read-Only View Objects from Tables"-page I do not select anything
    6. Create the AppModule on the "Appication Module"-page.
    7. Test the AppModule -> all is OK.
    8. Create the next ViewObject "DeptNew" with read-only access and Query: "SELECT DEPTNO FROM DEPT".
    9. Then I create a new attribute "JOB" for this ViewObject with Type String and Updatable: Always.
    10. Create a VeiwLink "DeptNewLink", on the "View Objects"-page: Cardinality -> 1 to 1.
    11. Source Attribute: DeptNew DeptNo -> Destination Attribute EmpView Deptno and click on Add
    12. Source Attribute: DeptNew Job -> Destination Attribute EmpView Job and click on Add.
    13. Edit the AppModule to add my DeptNew and DeptNewLink.
    When I test the AppModule and double click on the DeptNewLink then I can enter the 20 in the DEPTNO and CLERK in the JOB and see the result in the Table.
    Now I create the Master-Detail Form (at first without combobox) with wizard:
    1. As Master I select the DeptNew1, as Detail EmpView3.
    2. "Selected Attributes for Master" - Deptno, job.
    3. "Selected Attributes for Detail" - all attributes.
    Now I test my form in Query Mode:
    Enter 20 to the DEPTNO field and enter CLERK to the JOB field. After Execute Query I get:
    "JBO-27122: SQL-Fehler bei Vorbereitung der Anweisung. Anweisung: SELECT * FROM (select deptno from dept) QRSLT WHERE ( ( (DEPTNO = 20) AND (VIEW_ATTR LIKE 'CLERK') ) )"
    Why VIEW_ATTR how to change it to JOB?
    What have I done false?
    Please help me to create the combobox with the above listed requirements.
    Regards

    I'd go about this a little differently (probably not the best way):
    1. Create view object lk_department (lookup). In the query add a union with something like "select null as ID, 'All' as name' from dual;". This adds a null value that they can select by leaving the combo box on "All". Add a 'order by id" so the null value is the first one. When creating the combo box you want it set to navigation mode, so select the whole viewobject from the data palette rather a specific field.
    2. Create a jTextField for the "Jobs" field.
    3. Create an application module method that does something like:
    public void filterEmployees(String job){
    ViewObject vo_departments = findViewObject("lk_departments");
    ViewObject vo_employees = findViewObject("employees");
    String wc = "1 = 1 ";
    String wc = " and job like '%"+job+"%'"
    if (vo_departments.getCurrentRow().getAttribute("Id") != null) {wc += "and department_id = "+vo_departments.getCurrentRow().getAttribute("Id");}
    vo_employees.setWhereClause(wc);
    vo_employees.executeQuery();
    this.sync;
    4. In your Jclient app, you just need to call the method of your appmodule and insert the string from the textbox, using code similar to this:
    AppModule b = (AppModule)panelBinding.getApplicationModule();
    b.filterEmployees(jTextField.getText());
    I didn't test this code, but that's how I go about the same thing.

  • How to pass dynamically constructed string to where clause

    select name from mytable
    where l_condition
    and sal=20;
    l_condition is value coming from the function.
    ex: l_condition is first_name='abc' and last_name='xyz' and first_name='def' and last_name='zef'

    Dynamic SQL can help in this case:
    variable ref refcursor
    DECLARE
      l_condition VARCHAR2(1000) :=
          ' salary > 3000  and first_name like ''L%''';
    BEGIN
      OPEN :REF FOR
      ' SELECT first_name, salary FROM hr.employees ' ||
      ' WHERE ' || l_condition;
    END;
    print :ref;
    FIRST_NAME           SALARY                
    Laura                3630                  
    Lindsey              8800                  
    Lex                  18700                 
    Luis                 7590                  
    Louise               8250                  
    Lisa                 12650                 

  • Form Personalization - Custom Function - How to pass parameters?

    Hi,
    My requirement is to call a custom mod pl/sql program (html page) from purchasing when the "approve" button is pressed. I have it working, but don't know how to pass parameters to my function.
    I have my function defined and registered. In the definition under "Web HTML" tab, I have my pl/sql procedure call under "HTML Call". Where do the parameters go?
    On the customization of form POXPOEPO, I am using Builtin - Launch a function. I want to pass the po_header_id, so under "Parameters", I did "Insert Item Value" of :PO_HEADERS.PO_HEADER_ID
    My custom HMTL page is popping up, but the parameter is not being passed. Is there something in the Function Definition where I can define the incoming paramaters?
    Thanks.
    Paul

    Hi paul;
    There are many usefull link avaliable if you googling
    http://www.google.com.tr/#hl=tr&biw=1259&bih=793&&sa=X&ei=4wxQTZmYEISRswaNktWSDQ&ved=0CC4QBSgA&q=How+to+pass+parameters%2Bform+personalization&spell=1&fp=64d53dfd7a69225a
    Regard
    Helios

  • Form personalization - new custom function - how to pass parameters?

    Hi,
    My requirement is to call a custom mod pl/sql program (html page) from purchasing when the "approve" button is pressed. I have it working, but don't know how to pass parameters to my function.
    I have my function defined and registered. In the definition under "Web HTML" tab, I have my pl/sql procedure call under "HTML Call". Where do the parameters go?
    On the customization of form POXPOEPO, I am using Builtin - Launch a function. I want to pass the po_header_id, so under "Parameters", I did "Insert Item Value" of :PO_HEADERS.PO_HEADER_ID
    My custom HMTL page is popping up, but the parameter is not being passed. Is there something in the Function Definition where I can define the incoming paramaters?
    Thanks.
    Paul

    Post your question in below forum:
    General EBS Discussion
    -Anand

  • How to pass parameters between two xterm windows?

    Hi,
    I would like to know how to pass parameters between two xterm windows where there are two independence processes running on them respectively ? Would appreciate if any one out there can advise me . Thanks.

    Global variables can be used, but you can do what the online help
    says ...
    Parameters are passed to called forms by means of a parameter
    list. A parameter list is a named programmatic construct that is
    simply a list of parameter names (called keys) and their values.
    You can pass parameter values to forms invoked by the built-in
    subprograms CALL_FORM, OPEN_FORM, and NEW_FORM. In addition, you
    can pass parameter values to other Oracle tools with the
    RUN_PRODUCT procedure.
    A parameter you include in a parameter list can be either a text
    parameter or a data parameter. The parameter type determines how
    its value is interpreted.
    Text Parameters The value of a text parameter being passed to a
    called product is a CHAR string that can represent the following:
    n a user-defined form parameter defined in a form invoked
    by the CALL_FORM, OPEN_FORM, or NEW_FORM built-in subprograms
    n a command line or user-defined parameter for a product
    invoked with the RUN_PRODUCT built-in subprogram
    Data Parameters The value of a data parameter being passed to a
    called product is always the name of a record group defined in
    the current form. (A record group is a data structure that
    stores records derived from a query or through programmatic
    assignment.) Data parameters are used to pass data to products
    invoked with the RUN_PRODUCT built-in subprogram. You cannot
    pass data parameters to forms.
    The following table shows the structure of a parameter list that
    contains four parameters:
    Key Paramtype Value
    CITY Text_Parameter 'BOGOTA'
    CATEGORY Text_Parameter 'EXPORTS'
    MULTIPLIER Text_Parameter '.0275'
    NEW_DATA Data_Parameter 'RECORD_GROUP8'
    arun reddy (guest) wrote:
    : im trying to do this but i could not find any way for this.
    : can any one help me how can i pass parameters between two forms
    : in forms4.5. any help will be appreciated
    : thanks.
    null

  • Using round off function in where clause

    Hi All,
    I'm trying to use round off function in where clause, I seek help in completing this script.
    WITH CR_Details AS
    (Select
    request_id,
    parent_request_id,
    fcpt.user_concurrent_program_name Request_Name, phase_code, status_code,
    round((fcr.actual_completion_date - fcr.actual_start_date),3) * 24 * 60 as Run_Time,
    round(avg(round(to_number(actual_start_date - fcr.requested_start_date),3) * 1440),2) wait_time,
    fu.User_Name Requestor,
    fcr.argument_text parameters,
    to_char (fcr.requested_start_date, 'MM/DD HH24:mi:SS') requested_start,
    to_char(actual_start_date, 'MM/DD/YY HH24:mi:SS') ACT_START,
    to_char(actual_completion_date, 'MM/DD/YY HH24:mi:SS') ACT_COMP,
    fcr.completion_text
    From
    apps.fnd_concurrent_requests fcr,
    apps.fnd_concurrent_programs fcp,
    apps.fnd_concurrent_programs_tl fcpt,
    apps.fnd_user fu
    Where 1=1
    and fcr.concurrent_program_id = fcp.concurrent_program_id
    and fcp.concurrent_program_id = fcpt.concurrent_program_id
    and fcr.program_application_id = fcp.application_id
    and fcp.application_id = fcpt.application_id
    and fcr.requested_by = fu.user_id
    and fcpt.language = 'US'
    and fcr.actual_start_date like sysdate )
         select crd.*
         from CR_Details crd
         where Run_time <> '0'
         AND wait_time <> '0'
    GROUP BY
    crd.request_id,
    crd.parent_request_id,
    crd.fcpt.user_concurrent_program_name,
    crd.requested_start_date,
    crd.User_Name,
    crd.argument_text,
    crd.actual_completion_date,
    crd.actual_start_date,
    crd.phase_code,
    crd.status_code,
    crd.resubmit_interval,
    crd.completion_text,
    crd.resubmit_interval,
    crd.resubmit_interval_unit_code,
    crd.description
    Not sure about the GROUPBY function referencing the "crd." .

    Hi,
    The best thing for you to do is start over. Start as small as possible, then take baby steps.
    Pick one of the tables; fcr perhaps, and write a query that just uses that table, like this:
    SELECT    *
    FROM       apps.fnd_concurrent_requests     fcr
    WHERE       fcr.actual_start_date          >= TRUNC (SYSDATE)
    AND       fcr.actual_start_dt          <  TRUNC (SYSDATE) + 1
    ;(I think this is what you meant to do when you said "... LIKE SYSDATE".)
    Make sure this little query gets credible results. When that tiny query is working perfectly, add another line or two. You can cut and paste code from what you posted, if that helps you.
    If you get stuck, post the last version of your code that worked perfectly, and the latest version (only a line or two bigger) that has the problem. Describe what the problem is. If you get an error, post the complete error message. In any event, post CREATE TABLE and INSERT statements for all the tables and columns needed to run the query, and the results you want to get from that query.
    When you post any code, format it, so that how the code looks on the screen gives some clues about how it is working.
    When you post any formatted text on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    If you going to use the AVG function in the sub-query, then you probably need to do a GROUP BY in the sub-query.
    If you're not using any aggregate functions (like AVG) in the main query, then you probably don't want to do a GROUP BY in the main query.
    I know this is a lot of work.  I'm sorry.  If there was an easier way, I wouldn't ask you to do all this.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Can't have aggregate function in WHERE clause clause

    Dear all,
    I've created object in BO XI 3.1 Designer with following criterias:
    http://img4.imageshack.us/img4/833/20111201124314.th.jpg
    It is a simple number - 1,2,3,4,5.
    Now I need to use this object as a criteria for WHERE function in another object.
    http://img607.imageshack.us/img607/1543/20111201124717.th.jpg
    I receive an error "Can't have aggregate function in WHERE clause <clause>"
    How can I overcome this?
    P.S. I'm sorry in advance if such topic already exist - I didn't found one.
    Edited by: Ashot Antonyan on Dec 1, 2011 9:50 AM
    Edited by: Ashot Antonyan on Dec 1, 2011 9:51 AM

    Hi,
    You will have to use Sub query to achieve this. Give more details on what is available and what you need then i could help you out with the complete solution.
    Thanks,
    Ravichandra K

  • Using function in where clause

    I have created a function as follows
    create or replace FUNCTION get_codes RETURN varchar2 IS
    scodes varchar2(50) := 'A1,A2';
    BEGIN
    scodes := '('''||REPLACE(scodes,',',''',''')||''')';
    return scodes;
    END;
    this function returns ('A1','A2')
    now i want to use this in where clause, both below statements fetches no rows
    select * from tablea where code in (select get_codes from dual);
    select * from tablea where code in get_codes;
    but the following will fetch rows
    select * from tablea where code in ('A1','A2')
    how to use function in where clause
    Thanks

    Hi,
    The code that works:
    where code in ('A1','A2')is testing whther code is either of two 2-character strings, A1 or A2.
    The ones that don't work, such as:
    where code in get_codes;are comparing code to one 9-character string: 'A1','A2', where characters 1, 4, 6 and 9 are single-quotes. (The function can only return one value.)
    You can use dynamic SQL to embed that 9-character string in part of your query, where it will be interpreted as two 2-character strrings.
    [Oracle Base|http://www.oracle-base.com/articles/misc/DynamicInLists.php] and AskTom have good pages on the subject of dynamic IN-lists.
    Of you can use INSTR or LIKE:
    where INSTR ( get_codes
                , '''' || code || ''''
                ) > 0

  • Case function in where clause

    i insert the below rows in a table cash_book.
    PRJ_CODE PRJ_NAME
    1203 SHIFA
    1203 SHIFA
    1203 SHIFA
    1202 FATIMA
    1202 FATIMA
    1203 SHIFA
    if i select 1202 code then return 1202 code rows, if i select 1203 then returns 1203 code rows, if i select other than both values then returns all rows. how can i define in one query with use (case or decode function) in where clause ??

    perhaps something like this:
    create table test
    as
    select 1200 + rownum prj_code
      from dual
    connect by level <= 10;
    select * from test;
      PRJ_CODE
          1201
          1202
          1203
          1204
          1205
          1206
          1207
          1208
          1209
          1210
    var v_PRJ_CODE number
    exec :v_PRJ_CODE := 1200;
    select *
      from test
    where PRJ_CODE = :v_PRJ_CODE
        or 1 = case when :v_PRJ_CODE in (1202, 1203) then 0 else 1 end;
      PRJ_CODE
          1201
          1202
          1203
          1204
          1205
          1206
          1207
          1208
          1209
          1210
    exec :v_PRJ_CODE := 1203;
    select *
      from test
    where PRJ_CODE = :v_PRJ_CODE
        or 1 = case when :v_PRJ_CODE in (1202, 1203) then 0 else 1 end;
      PRJ_CODE
          1203Regards
    Martin

  • Clarification on using function in where clause of oracle sql query

    I have an issue in regarding function using where clause of sql query..
    We are facing performance issue while executing query, so in what ways to improve the performance of the query which i have posted below.
    select col ,case when my_function(parameter)
    from tab1 a ,tab2 b,tabl3 c
    where a.column1=b.column2
    and b.column3 =c.column6
    and my_function(parameter)>0
    Regards
    Dinesh
    Edited by: wild fire on May 18, 2012 4:15 PM

    Dinesh,
    remind that when you use a function in the where clause it normally will get started for each record in the table.
    So your answer is two-fold:
    1. make the function only start when needed by adding a function based index on the table (this will make inserts and updates slower)
    2. make the function faster by adding the DETERMINISTIC clause if possible. this will make Oracle "cache" the result of the function.
    Regards,
    Richard
    blog: http://blog.warp11.nl
    twitter: @rhjmartens
    If this question is answered, please mark the thread as closed and assign points where earned..

Maybe you are looking for

  • New TO JAVA Programming

    Dear Forummembers, I am student doing postgraduate studies in IT.i have some queries related to one of my programming staff.i am very much new into Java programming and i am finding it a bit difficult to handle this program.The synopsis of the progra

  • Partner functions for a specific customer not seen in XD03 but appears in XD02

    Hello SAP Gurus, I have a situation where a partner functions for a specific customer not seen in XD03 but appears in XD02, In XD03 only one partner function (Ship to) appears but in XD02 (Sold to, Ship to, Bill to and payer appears), from the custom

  • Can't use Oracle 8.1.7 as WLP repository

    OK, I've been racking my brain on this for three days now.. maybe someone has an idea... The basic problem is this: I have yet been able to make a WLP content repository work with Oracle 8.1.7 and WLP 8.1. I have tried several methods, including the

  • Set-Up 2 New Accounts - Nobody has Write Rights

    For the first time ever I've set up my Mac with a few different user accounts, one for my intern and one for guests. I've placed all of the files I'd like these two users to have access to in my Shared folder. However, when I log-in as anyone but mys

  • Another process (thread) is applying transactions for this client:

    Has anyone seen this error 'Another process (thread) is applying transactions for this client: MNEWMAN Try again later.' We seem to be getting a few upload transactions put into the error queue for this reason, sometimes just executing the transactio