XSQL with optional parameters

I am trying to create an XSQL page that has optional parameters.
What I mean is, I would like the page to return all records for a query when the following url is used http://myserver.com/my_inventory.xsql
And I would like the page to return limited records for a query when the following url is used http://myserver.com/my_inventory.xsql?item=123
I have been trying the following with no success. Any suggestions?
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="rowset2inventorylevel.xsl"?>
<xsql:if-param name="item" exists="no">
<xsql:query connection="myconn" tag-case="lower" xmlns:xsql="urn:oracle-xsql">
select m.item_no
, m.description
, m.qty_on_hand
, nvl(p.gross_wt,0) weight
from item_master m
, item_price p
where m.item_no = p.item_no
and m.status_flag='A'
and m.discontinue_flag = 'N'
order by m.item_no
</xsql:query>
</xsql:if-param>
<xsql:if-param name="item" exists="yes">
<xsql:query connection="myconn" tag-case="lower" xmlns:xsql="urn:oracle-xsql">
select m.item_no
, m.description
, m.qty_on_hand
, nvl(p.gross_wt,0) weight
from item_master m
, item_price p
where m.item_no = p.item_no
and m.status_flag='A'
and m.discontinue_flag = 'N'
and m.item_no = ?
order by m.item_no
</xsql:query>
</xsql:if-param>

The easy, but less optimal way, is to use OR in your where clause:
rewrite "and m.item_no = ?" to "and m.item_no = ? or ? is null" - and remember to include the parameter twice in bind-params.
The "right" way to do this, meaning a more optimal access path, is to use stored procedures that returns REF CURSORs. Then in the stored procedure you look for NULL and change the where clause accordingly.

Similar Messages

  • Registering  PL/SQL procedure in APPS with optional parameters

    I want to register a PL/SQL procedure as follows in Oracle APPS.
    Problem:
    The procedure is to pick up employee details from a table.I need to pass empno as the parameter(or as an input) to the procedure.I want this parameter registered as an optional parameter. This means if I input a value to this parameter, then the procedure will pick up employee details for that empno. If I do not pass any value to this parameter, then procedure will pick employee details for all employees.
    Also how can pass two optional parameters to pick employee details for a range of employee numbers?
    Thanks

    How are you calling your PL/SQL procedure and how are you planning on returning your results?
    You don't actually need to have an optional parameter - you could simply pass a NULL value for the EmpNo parameter. If you do want to not reference the parameter at all you can provide a default in the parameter definition.
    Assuming that you want to return your results as a cursor, you could do something like:
    FUNCTION GetEmpDetails ( EmpNo_i IN VARCHAR2 DEFAULT NULL ) RETURN SYS_REFCURSOR;

  • Crystal Report with Optional Parameters from Stored Procedure

    I have a client who created a Crystal Report. This report is linked to a Stored Procedure which allows for input on two criteria. Both of these critera are static values. However, the second of these parameters is setup to allow the user to enter up to 20 values. For example, the Stored Procedure needs the CARDCODE, and a set of DOCUMENTS. So the parameters/prompts would look like this...
    BP CardCode:
    Document1:
    Document2:
    Document3:
    ...etc...
    The report will just display basic document information for those documents that were entered.
    With 8.8, these parameters were changed to be REQUIRED.... not OPTIONAL. According to SAP note 1500777, this is a known bug and will be fixed in future versions. This note also states to change the criteria for the filter. However, when using a Stored Procedure, this does not appear to be an option, as the selection is defined by the data connection (and the parameters defined in the SP).
    Am I missing something? Is there a way to make the suggetion in the above note work with my Stored Procedure?
    Or, is there another way to make these parameters optional? (Do I need to change the SP?)
    Thanks!
    ~ terry.

    I have a client who created a Crystal Report. This report is linked to a Stored Procedure which allows for input on two criteria. Both of these critera are static values. However, the second of these parameters is setup to allow the user to enter up to 20 values. For example, the Stored Procedure needs the CARDCODE, and a set of DOCUMENTS. So the parameters/prompts would look like this...
    BP CardCode:
    Document1:
    Document2:
    Document3:
    ...etc...
    The report will just display basic document information for those documents that were entered.
    With 8.8, these parameters were changed to be REQUIRED.... not OPTIONAL. According to SAP note 1500777, this is a known bug and will be fixed in future versions. This note also states to change the criteria for the filter. However, when using a Stored Procedure, this does not appear to be an option, as the selection is defined by the data connection (and the parameters defined in the SP).
    Am I missing something? Is there a way to make the suggetion in the above note work with my Stored Procedure?
    Or, is there another way to make these parameters optional? (Do I need to change the SP?)
    Thanks!
    ~ terry.

  • How to create default web service constructor with optional parameters in C#

    hi senior :)
    i tried to create a web services with a default constructor and another that takes few arguments, no matter
    what i do I couldn't call the non default constructor from the client! how can I pass my arguments in the constructor? worse yet, I tried to pass my arguments to another exposed WebMethod, guess what? the public or private variables i'm trying to update,
    do not get updated, what gives? any documentation on how to use web services? i'm pretty newbie at this. thanks

    http://forums.asp.net/
    You need to post to Web services section in the above forum.

  • Hierarchy on HANA Calculation View with Optional Input Parameters Fails

    Hi,
    Has anyone succeeded in building a hierarchy on top of a calculation view with optional input parameters, where an input parameter is not filled?
    The original requirement came from the wish to create a parent child hierarchy on a calculation view that was copied into the customer space from a HANA Live Financial Statement query view, but I have found the following when creating a simple level hierarchy on a calculation view that consumes one table. The Calculation View has one Input Parameter where the 'mandatory' box is unchecked.
    Calculation view reads ECC table FAGLFLEXT
    Simple level based hierarchy on fields PRCTR, RACCT and SEGMENT
    Input parameter is used as a filter for PRCTR with logic ("EMPTY" = '$$P_PROFITCTR$$' or "PRCTR" = '$$P_PROFITCTR$$')
    When I run the view I see the following behaviour in HANA Studio and Analysis for Excel
    Before building the hierarchy I could run the view with or without the Input Parameter
    After building the hierarchy I can run the view with the Input Parameter filled, but it fails when the Input Parameter is not filled.
    Error message is "error: search table error:  [2426] missing placeholder; missing value for mandatory parameter P_PROFITCTR"
    P_PROFITCTR is not a mandatory parameter, but the selection for the hierarchy view thinks it should be. I don't find any notes around this issue, so I don't think it's version related, however the version I have used for this test is 1.00.70.
    It's a shame we can't currently build the hierarchy as the parent child relationship is provided in HANA Live view NewGLFinancialStatementQuery.
    Thanks,
    Ken

    Hi Ken,
    We have been facing similar issue. We have even tried to set default value and as optional parameter. View still fails to create hierarchy (we are not using HANA live). As mentioned on page 97 of HANA modelling guide input parameter is mandatory from engine point of view. Hierarchy is generated as column view during the initial activation of calculation view and therefore expect a value by caller.
    This seems to be a product error. Some one from HANA development team should explain this issue in detail. I would expect someone like Thomas Jung reply to us.
    At the moment, we cant use input parameter for date prompt which gives us calendar popup feature for date selection. Hierarchies just don't work with input parameter. We are missing something.
    Regards
    Angad

  • XSQL Command-Line, parameters with blanks

    Is it possible to use XSQL Command-Line with parameters containing blanks (space characters).
    In an URL parameter spaces can be encoded with "+" or "%20", but this does'nt seem to work with XSQL Command-Line parameters.
    -- Peter

    I can't make this work on Unix (solaris), but I can see it is a shell script problem, not a XSQL problem.
    The normal syntax for Unix shell script would be
    $ script.sh foo="one two"
    but the standard Oracle-supplied xsql unix shell script sets environment and passes all command-line parameters to the java program with
    oracle.xml.xsql.XSQLCommandLine $*
    and thereby the quotes disappear.
    The problem is not really big, since I could just do
    oracle.xml.xsql.XSQLCommandLine test.xsql "foo=one two"
    after setting classpath. Anyway, if anybody knows how to make the xsql script work with quoted parameters, let me know.
    -- Peter

  • DBMS_SCHEDULER.CREATE_PROGRAM with Optional input parameters

    I have a procedure that has a number of "optional" parameters.
    procedure get_files(
    file_name_in in varchar2 default 'dummy_file',
    layout_in in number default 1,
    client_in in number default null,
    data_supplier_in in number default 99999
    This procedure can be called with any combination of the input parameters.
    I can set up program(s) using the DBMS_SCHEDULER.CREATE_PROGRAM procedure using a program_type => 'PLSQL_BLOCK' like this:
    begin
    sys.dbms_scheduler.create_program(
    program_name => 'GET_MY_FILES',
    program_action => '
    declare
    begin
    get_files( layout_in => 11111, client_in => 2222 );
    end ;',
    program_type => 'PLSQL_BLOCK',
    number_of_arguments => 0);
    end;
    My question is: Can I set up programs(s) using the DBMS_SCHEDULER.CREATE_PROGRAM procedure using a program_type => 'STORED_PROCEDURE' when I have "optional" parameters?
    It appears that ALL of the program input parameters must be defined and there is no way to indicate that a parameters is "optional".

    Yes you can do it.
    You can defined default values for program parameters, but this values are "constants". So if your default value of parameter is defined by function call you have a problem, because you have to specify this parametr every time.
    procedure my_proc(p_date IN DATE := SYSDATE) AS
    ...There is my example, it using DBADMIN schema create this schema or replace it.
    create or replace procedure dbadmin.sleep(p_interval in number)
    as
    begin
      dbms_lock.sleep(p_interval);
    end;
    --program definition
    begin
        dbms_scheduler.create_program(program_name => 'dbadmin.prg_test1',
                                      program_type => 'STORED_PROCEDURE',
                                      program_action => 'dbadmin.sleep',
                                      number_of_arguments => 1);
        dbms_scheduler.define_program_argument(program_name => 'dbadmin.prg_test1',argument_position => 1,argument_type => 'NUMBER',default_value => 60);
        dbms_scheduler.enable(name => 'dbadmin.prg_test1');                                 
    end;
    --check that program was created
    select * from dba_scheduler_programs
    where owner='DBADMIN';
    select * from dba_scheduler_program_args
    where owner='DBADMIN';
    BEGIN
        dbms_scheduler.create_job(job_name        => 'dbadmin.job_program1',
                                  program_name    => 'dbadmin.prg_test1',
                                  start_date      => to_timestamp_tz('1.1.2010 12:00 Europe/Prague', 'dd.mm.yyyy hh24:mi tzr'),
                                  repeat_interval => 'FREQ=minutely; INTERVAL=2;BYSECOND=0',
                                  auto_drop       => FALSE);
        dbms_scheduler.enable(name => 'dbadmin.job_program1');
    END;
    --job run checks
    SELECT *
    FROM   dba_scheduler_jobs j
    WHERE  j.JOB_NAME = 'JOB_PROGRAM1';
    SELECT *
    FROM   dba_scheduler_job_log jl
    WHERE  jl.JOB_NAME = 'JOB_PROGRAM1';
    SELECT *
    FROM   dba_scheduler_job_run_details jr
    WHERE  jr.JOB_NAME = 'JOB_PROGRAM1';   
    --now set job parametr
    BEGIN
        dbms_scheduler.set_job_argument_value(job_name => 'dbadmin.job_program1', argument_position => 1, argument_value => 30);
    END;
    --clean up
    BEGIN
        dbms_scheduler.drop_job(job_name => 'dbadmin.job_program1', force => TRUE);
        dbms_scheduler.drop_program(program_name => 'dbadmin.prg_test1');
        dbms_scheduler.purge_log;
    END;
    /

  • How can I install Firefox SILENTLY in a specific installation folder, -ms with which parameters ?

    How can I install Firefox SILENTLY in a specific installation folder, -ms with which parameters ?
    "Firefox.exe_path" -ms OPTIONS ??
    Thanks.

    '''Is there a way to download FF to a USB from another computer and install it from that USB on my PC? '''
    You basically answered your own question. If you have access to another computer just go download the appropriate language and OS version of Firefox 5.0 from http://www.mozilla.com/en-US/firefox/all.html and put it on you usb drive and then go and install it onto you pc.

  • Calling a Stored Procedure with output parameters from Query Templates

    This is same problem which Shalaka Khandekar logged earlier. This new thread gives the complete description about our problem. Please go through this problem and suggest us a feasible solution.
    We encountered a problem while calling a stored procedure from MII Query Template as follows-
    1. Stored Procedure is defined in a package. Procedure takes the below inputs and outputs.
    a) Input1 - CLOB
    b) Input2 - CLOB
    c) Input3 - CLOB
    d) Output1 - CLOB
    e) Output2 - CLOB
    f) Output3 - Varchar2
    2. There are two ways to get the output back.
    a) Using a Stored Procedure by declaring necessary OUT parameters.
    b) Using a Function which returns a single value.
    3. Consider we are using method 2-a. To call a Stored Procedure with OUT parameters from the Query Template we need to declare variables of
    corresponding types and pass them to the Stored Procedure along with the necessary input parameters.
    4. This method is not a solution to get output because we cannot declare variables of some type(CLOB, Varchar2) in Query Template.
    5. Even though we are successful (step 4) in declaring the OUT variables in Query Template and passed it successfully to the procedure, but our procedure contains outputs which are of type CLOB. It means we are going to get data which is more than VARCHAR2 length which query template cannot return(Limit is 32767
    characters)
    6. So the method 2-a is ruled out.
    7. Now consider method 2-b. Function returns only one value, but we have 3 different OUT values. Assume that we have appended them using a separator. This value is going to be more than 32767 characters which is again a problem with the query template(refer to point 5). So option 2-b is also ruled out.
    Apart from above mentioned methods there is a work around. It is to create a temporary table in the database with above 3 OUT parameters along with a session specific column. We insert the output which we got from the procedure to the temporary table and use it further. As soon the usage of the data is completed we delete the current session specific data. So indirectly we call the table as a Session Table. This solution increases unnecessary load on the database.
    Thanks in Advance.
    Rajesh

    Rajesh,
    please check if this following proposal could serve you.
    Define the Query with mode FixedQueryWithOutput. In the package define a ref cursor as IN OUT parameter. To get your 3 values back, open the cursor in your procedure like "Select val1, val2, val3 from dual". Then the values should get into your query.
    Here is an example how this could be defined.
    Package:
    type return_cur IS ref CURSOR;
    Procedure:
    PROCEDURE myProc(myReturnCur IN OUT return_cur) ...
    OPEN myReturnCur FOR SELECT val1, val2, val3  FROM dual;
    Query:
    DECLARE
      MYRETURNCUR myPackage.return_cur;
    BEGIN
      myPackage.myProc(
        MYRETURNCUR => ?
    END;
    Good luck.
    Michael

  • ABAP WebDynpro app calling Transaction iview with Dynamic Parameters..?

    Good day!
    I need to code a call to a transaction (with dynamic parameters) from an Abap WD application.  It appears that to achieve this, the app needs to call a new portal transaction iview, passing the parameters in the call..? 
    This should ideally be via a Sapgui for Windows, but Html also an option (does it matter with regards to the method used?). 
    Kindly assist with advise/instructions, idealy with sample code extract to illustrate (new to Abap WD)...
    Kind regards
    j

    Hi
    this will help you doing so
    http://help.sap.com/saphelp_nw04s/helpdata/en/18/f96f4132f15c58e10000000a1550b0/frameset.htm
    Use BUSINESS_PARAMETERS to pass the data
    Abhi

  • Start IC WebClient with URL Parameters

    Hi,
    we are currently implementing IC WebClient 5.0. One of the customer needs is it, to start the IC WebClient with a service order ID, so that the order is displayed immediately without searching and confirming an account. Is it possible to start the IC WebClient with URL parameters to solve that issue?
    Thank you for you help in advance!
    Marcus Walena

    Hallo Marcus,
    This is currently not possible.
    However, you don't need to always confirm the customer. You can use the agent inbox to do the search and navigate directly to the service order. However, if you want to do any processing after that, then you will need to identify the customer. The other option is to implement this yourself.
    BTW: It is possible to navigate via a URL to the service order directly using PC UI.
    Regards,
    Shiv

  • Auto run report with default parameters in Viewer

    Hi,
    Can any one tell me if it's possible to automatically run reports in Disco Viewer with default parameter values?
    For example, I have a worksheet with a parameter like 'Term like :Term Code' which has a default value of '%'.
    When I open the sheet in Viewer I'm presented with the Confirmation screen with default parameter values displayed and then click OK to run report. Is there a way to skip the confirmation screen and just run the sheet with default values as soon as it's opened?
    I tried using the 'Run Query Automatically' option in Query Governor preference but this results in Viewer opening the Edit Parameters screen instead of the confirmation screen.
    What I'd ideally like to do is bypass both the Confirmation and Edit Parameters screen to automatically run the worksheet with default parameters as soon as it's selected.
    Any thoughts appreciated,
    Ien Hien

    Hi,
    Option 1
    If the user is clicking on a URL for the report you could code the parameters directly into the URL thus, they are passed on startup. Section 13.5.2 Example 2 of the below URL provides an example:
    http://download.oracle.com/docs/html/B13918_03/urlstart.htm#i1014363
    Option 2 (Not Exactly what your looking for)
    This would still require a user to click something but, if your passing a wildcard it should probably be considered,
    If the parameter might be a wild card your better off making it an Optional Parameter which is now possible in Discoverer Plus 10.1.2. Thus, instead of passing an expensive % sign the condition will simply be ignored.
    Hopefully this helps....
    Jeff

  • Using a StoredProcedure with OUT parameters in CrystalReports

    Hi All,
    I am creating a report using CrystalReport Designer 2008.I have a StoredProcedure which takes 2 input parameters,2 output parameters and a cursor.I am not able to add this SP directly using the DatabaseExpert. if I use
    'call SP1(input1,input2,input3,input4,@output1,@output2)' from AddCommand option then it gets added as a Command but the tree under Command does not expand and it does not allow me to use the output parameters in my reports.
    Hence,can anyone please help me here such that how should I use this SP with out parameters in my CrystalReports.Also note that I am able to use StoredProcedure with only input parameters,with input parameters and cursor in my CrystalReports.Should I do something extra to add this StoredProcedure in my CrystalReports?
    Any help for this issue would be highly appreciated.
    Regards.
    Ajit

    Ajit,
    If you are using a Command, you execute a SP in CR with the same syntax that you would in the databases native environment.The only difference is that you'll need to add CR parameters so that the inputs can be added to the SP's input parameters.
    So, using your example... 'call SP1({?input1}, {?input2}, {?input3} , {?input4}, output1, output2)'
    I'm not familiar with this particular syntax but hopefully you get the idea.
    If you want to hard code the input parameters (and not have them prompt in CR), just hard code them in the command.
    HTH,
    Jason
    Edited by: Jason Long on Aug 25, 2010 2:15 PM

  • Call a Graphical Calc view with input Parameters from a Script Based Calc View

    Hi All.
    I am trying to call a graphical calculation view with input parameters from a script based calculation view as below but getting syntax error:
    SESSION_SAMPLE = SELECT SESSION_CREATE_DATE,SHA256,CA_MEASURE
                                 FROM "_SYS_BIC"."WILDFIRE/CV_SESSION_SAMPLE"
                                 WITH PARAMETERS  ('PLACEHOLDER' = ('$$IP_START_DATE$$',:START_DATE),
                                     'PLACEHOLDER' = ('$$IP_END_DATE$$',:END_DATE));
    START_DATE  and END_DATE are input parameters of the script based calculation view.
    Can anyone please help me with the correct syntax for accomplishing this?
    Thanks,
    Goutham

    Hi Gautham,
    One more option  what i would like you to try is the below option , here i have just changed the order of passing nothing else.
    SESSION_SAMPLE = SELECT SESSION_CREATE_DATE,SHA256,CA_MEASURE
                                 FROM "_SYS_BIC"."WILDFIRE/CV_SESSION_SAMPLE"
                                   ('PLACEHOLDER' = ('$$IP_END_DATE$$','$$END_DATE$$'),
                                  'PLACEHOLDER' = ('$$IP_START_DATE$$','$$START_DATE$$'))
    Regards,
    Vinoth

  • How to record who run a runbook and with some parameters?

    Hello,
    I would like to record who run the runbook and with some parameters.
    There is some option build in at Orchestrator that will give me that info?
    Thanks!

    Hi,
    Logging is not really the best Choice, like Stefan mentioned, SQL Database will grow very fast.
    For the Input Parameters, you can add a Textfile Activity to write your own Lofgile.
    To get the User, which has startet teh Runbook, you Need to query the SQL Server, but i created a Runbook for that, so you Need to Invoke my Runbook in your Runbook, and you will receive the User which started the Runbook
    RB can be found here:
    https://gallery.technet.microsoft.com/Get-User-Informations-c3e64d6e
    Seidl Michael | http://www.techguy.at | twitter.com/techguyat |
    facebook.com/techguyat |
    youtube.com/techguyat

Maybe you are looking for

  • Syntax highlighting not working with label on if statement in fortran in Visual studio 2010

    I am having a difficult time in figuring out the syntax highlighting in Visual studio. I am using fortran code and there are labels in if statements as follows:              if_2003: IF (FRAC_PBED(NNSED,L).LT.0.0.AND.      +                   FRAC_PB

  • No success moving iTunes library to external hard drive

    I'm trying to move my iTunes library to an external hard drive to free up some space on my laptop.  I'm working on a Macbook running OSX 10.8.2 and trying to transfer the library to a WD My Passport for Mac (which is optimized for Mac OS Extended). 

  • External monitor going blank!

    Hello, I have a exrernal Dell 24' monitor that has been working 100% ok for years on my macbook now am running 10.7.2. I use the mac in clam mode and using the Dell as the main monitor. Today I have a problem as after around 10mins of uses the monito

  • How to take .tbl file?

    hi team, Could you pls tell me about how to take .tbl files from SQL server. Since i need to bulk insert a value into another table for this datafile need to be in .tbl format. FYR. BULK INSERT AdventureWorks.Sales.SalesOrderDetail FROM 'f:\orders\li

  • Build DC versus Build project

    Hi all, I have a Web Dynpro DC (managed by NWDI) in my developer studio. I'm wondering what the precise difference is between building the DC and building the project. Do I ever need to build the project at all? When I want to do direct deployment fr