Lexical Parameter

Hi all
i need to make a dynamic report using lexical parameter but in the SQL Part when I write the SQL(select name,ID from &p_where)
it gives me syntax error ....i tired to use report query builder also telling me query builder not support lexical parameter....i need help in that matter please..

To use lexical parameters in Reports, use need to specify a default value. If you don4t do this, Reports will return an error. Hope that helps you.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by wafaa ahmed:
Hi all
i need to make a dynamic report using lexical parameter but in the SQL Part when I write the SQL(select name,ID from &p_where)
it gives me syntax error ....i tired to use report query builder also telling me query builder not support lexical parameter....i need help in that matter please..<HR></BLOCKQUOTE>
null

Similar Messages

  • Can we use formula column in lexical parameter in sql query ...

    hi
    can we use formula column in lexical parameter in sql query ...
    as example
    i want to give
    select * from & c_table
    forumula
    function c_table
    if :p_sort = 1 then
    return 'dept'
    else
    return 'emp'
    end;
    c_table formula column
    is this possible ...
    i have such example in oracle apps reports
    if i try in ordinary report usinf emp table it show error ..
    how we can give formula column...
    please help me in this regard...
    Edited by: 797525 on Feb 20, 2012 9:31 PM

    thanks sir,
    iam not exactly saying select * from &c_table but some thing that like columns in select stmt also will be populated in user_parameters ,there are lot of table select.......from     mtl_demand md,     mtl_system_items msi,     mtl_txn_source_types     mtst,     mtl_item_locations loc     &C_source_from &C_from_cat
    &c_source_from and &c_from_cat formula column and there are defined at report level only ......
    pl/sql code &c_source_from is
    function C_source_fromFormula return VARCHAR2 is
    begin
    if :P_source_type_id = 2 then return(',MTL_SALES_ORDERS mkts');
    else if :P_source_type_id = 3 then return(',GL_CODE_COMBINATIONS gl');
    else if :P_source_type_id = 6 then return(',MTL_GENERIC_DISPOSITIONS mdsp');
    else if :P_source_type_id = 5 then
         if :C_source_where is null then
              return NULL;
         else
              return(',WIP_ENTITIES wip');
         end if;
    else if :P_source_type_id = 8 then return(',MTL_SALES_ORDERS mkts');
    else if :P_source_type_id is null then
    return(',MTL_SALES_ORDERS      mkts,
    MTL_GENERIC_DISPOSITIONS mdsp,
    GL_CODE_COMBINATIONS gl ');
    else null;
    end if; end if; end if; end if; end if; end if;
    RETURN NULL; end;
    this is forumula column i hope that you understand what iam saying
    please help me in this regard....
    thanking you...

  • Lexical parameter in select statement showing null or column name in xml tag instead of value

    Hi,
    i am using lexical parameter in report select statement as
    Select &order value from oe_order_headers_all a where order_number ='7889'
    and setting  : order:='a.order_number';  in after parameter form trigger.
    lexical parameter intial value set to null
    when i run this report , its not showing order number in output ,its showing null or a.order_number as text.
    Please help.

    try this
    Select &order data_show
    from oe_order_headers_all
    where order_number ='7889'
    and setting  :order:='order_number';  in after parameter form trigger.
    Hope this helps
    Hamid

  • How to use lexical parameter in report

    i want to use lexical parameter in report and pass parameter from form how it is possible in detail
    A.R

    Hi,
    typically you fill your lexical paramter in the after-paramform-trigger out of the values of your bind-parameters (giving end users directly control over lexical parameters might not be a good idea). Inside PL/SQL a lexical parameter is referenced like bind parameters with ":". In the query it's referenced via "&" and represents a part of the query.
    A simple example.
    - p_deptno as bind parameter
    - p_where as lexical paramter
    - end user choose value for p_deptno (10,20,... or nothing)
    - Trigger: if :p_deptno is not null then
    :p_where := 'WHERE deptno = :p_deptno'
    else
    :p_where := null;
    end if;
    - Query select ... from emp &p_where
    Regards
    Rainer

  • Calling report from form with lexical parameter

    hi
    DECLARE
         repid REPORT_OBJECT;
         v_rep VARCHAR2(1000);
         rep_status VARCHAR2(20);
    BEGIN
              repid := FIND_REPORT_OBJECT( 'REPORT34' );
              set_report_object_property(repid,report_other,'p_SEASON_YEAR='||:SALE_ORDER.SEASON_YEAR
              ||' &sort='||:sale_order.sort1);
              --set_report_object_property(repid,report_other,'p_g_id =20');
              v_rep := RUN_REPORT_OBJECT(repid);
              rep_status := REPORT_OBJECT_STATUS(v_rep);
    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
    LOOP
    rep_status := report_object_status(v_rep);
    END LOOP;
    IF rep_status = 'FINISHED' THEN
    --Display report in the browser
    WEB.SHOW_DOCUMENT('http://127.0.0.1:8889/reports/rwservlet/getjobid'||
    substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver90','_blank');
    ELSE
    message('Error when running report');
    END IF;
    PAUSE;
    END;i had made a lexical parameter in reports the reports code is
    SELECT s.season_year,sd.prod_id,P.PROD_NAME,sum(sd.total_qty)
    FROM sale_order s,sale_order_detail sd,PRODUCT P,CUSTOMER_MASTER cm,CUSTOMER_DETAIL cd
    where s.id=sd.id and P.PROD_ID=SD.PROD_ID AND s.season_year = :p_season_year
    AND CD.CUST_ID=CM.CUST_ID AND CD.CUST_ID=S.CUST_ID AND CD.COUNTRY NOT LIKE 'SPA%' AND Sd.PROD_ID LIKE  'CA%'
    group by s.season_year,sd.prod_id,P.PROD_NAME
    &sortthanks and regards
    vikas

    Vikas,
    So, is your code producing an error when your report is called? Also, it would be helpful to know your Forms and Reports versions. Is ":p_season_year" set up as a USER_PARAMETER (UP) in your report or is it a true lexical parameter (meaning you should reference it with '&' instead of ':')? If it is a UP, the typical way to pass a value to this UP from Forms is to use a ParamList object instead of the REPORT_OTHER parameter of the Set_Report_Object_Property built-in. For example:
    DECLARE
       pl_id    ParamList;
       pl_name  VARCHAR2(10) := 'REPORT34';
       v_rep VARCHAR2(1000);
       rep_status VARCHAR2(20);
    BEGIN
       pl_id := Get_Parameter_List(pl_name);
       IF id_null(pl_id) THEN
          pl_id := Create_Parameter_List(pl_name);
       END IF;
       Add_Parameter(pl_id, 'P_SEASON_YEAR', TEXT_PARAMETER, :SALE_ORDER.SEASON_YEAR);
       repid := FIND_REPORT_OBJECT( 'REPORT34' );
       v_rep := RUN_REPORT_OBJECT(repid, pl_id);
       ...  rest of your code here  ...
    END;Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Lexical Parameter help

    Hello,
    In my beforereport trigger, I have Lexical parameter defined as:
    :LP_CUSIP := 'WHERE F.TS_CUSIP = SUBSTR(A.FUND_CUSIP,1,9) AND F.TS_CUSIP = SUBSTR('||''||:PM_FUND||''||',1,9)
    But It gives a REP-1401 :'beforereport': Fatal PL/SQL error occured.
    ORA-06502 : PL/SQL : numeric or value error.
    But the query works fine with :
    where
    f.ts_cusip = substr(a.FUND_CUSIP,1,9)
    and f.ts_cusip = SUBSTR('351899992000',1,9)
    Any help would be appreciated.
    Thanks.

    hi,
    How are you building the query in the data model?
    I'd do this in the data model:
    select
    from
    where ...(another conditions you have or 1=1) &lp_cusip
    And in the "after parameter form",I'd put this code:
    :LP_CUSIP := 'and F.TS_CUSIP = SUBSTR(A.FUND_CUSIP,1,9) AND F.TS_CUSIP = SUBSTR('||''''||:PM_FUND||',1,9)'||'''';
    aguero
    ================
    Gives the compilation error

  • Passing Condition as lexical parameter

    Hi All,
    I am developing one XML report by using XML Dtata templet.
    I have the require ment like to check the cdition on bassis of the USER Parameter value if the parameter is null then place the min and max value of the column.
    In my data templet I declare the lexical parameter
    And in my PL/SQL package I declare the function where I am building the string.
    When I am submitting the cuncorrent program it is throughing me the error.
    Data templet
    <?xml version="1.0" encoding="UTF-8" ?>
    <dataTemplate name="XXGLR005_1" defaultPackage="XXX_GL_GLSPF_XMLP_PKG" version="1.0">
    <properties>
    <property name="include_parameters" value="true"/>
    <property name ="debug_mode" value="on" />
    </properties>
    <parameters>
              <parameter name="p_ledger" dataType="varchar2"/>
              <parameter name="p_balancing" dataType="varchar2"/>
              <parameter name="p_start_period" dataType="varchar2"/>     
              <parameter name="p_end_period" dataType="varchar2"/>
              <parameter name="p_start_fc" dataType="varchar2"/>
              <parameter name="p_end_fc" dataType="varchar2"/>
              <parameter name="p_start_site" dataType="varchar2"/>          
              <parameter name="p_end_site" dataType="varchar2"/>
              <parameter name="p_where" dataType="varchar2"/>
         </parameters>
    <lexicals>
    </lexicals>
    <dataQuery>
    <sqlStatement name="Q_1">
    <![CDATA[
    SELECT account,
    account_description,
    SUM (amount_period_range) amount_period_range,
    SUM (fisical_ytd_amount) fisical_ytd_amount,
    SUM (cumilative_found) cumilative_found,
    account_type,actual_flag,period_name
    FROM (SELECT gcc.segment4 ACCOUNT, ffv.description account_description,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN (ba.period_net_dr - ba.period_net_cr)
    ELSE (ba.period_net_dr_beq - ba.period_net_cr_beq)
    END
    ) AS amount_period_range,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN ( (ba.begin_balance_dr - ba.begin_balance_cr)
    + (ba.period_net_dr - ba.period_net_cr)
    ELSE ( (ba.begin_balance_dr_beq
    - ba.begin_balance_cr_beq
    + (ba.period_net_dr_beq - ba.period_net_cr_beq)
    END
    ) AS fisical_ytd_amount,
    (CASE ba.currency_code
    WHEN 'CAD'
    THEN ( (ba.begin_balance_dr - ba.begin_balance_cr)
    + (ba.project_to_date_dr - ba.project_to_date_cr
    ELSE ( (ba.begin_balance_dr_beq
    - ba.begin_balance_cr_beq
    + ( ba.project_to_date_dr_beq
    - ba.project_to_date_cr_beq
    END
    ) AS cumilative_found,
    gcc.account_type account_type, ba.period_name,
    ba.actual_flag
    FROM gl_code_combinations gcc,
    gl_balances ba,
    gl_periods gp,
    fnd_flex_value_sets fvs,
    fnd_flex_values_vl ffv
    WHERE gcc.code_combination_id = ba.code_combination_id
    AND ba.period_name = gp.period_name
    AND ffv.flex_value_set_id = fvs.flex_value_set_id
    AND ffv.flex_value = gcc.segment4
    AND fvs.flex_value_set_name = 'AHS_ACCOUNT'
    AND ba.actual_flag <> 'B'
    AND gcc.segment1 = '101'
    &p_where
    AND gcc.segment2 BETWEEN '0006' AND '0006'
    AND gcc.segment4 = '31030000'
    AND gp.start_date >= TO_DATE ('01/08/2010', 'DD-MM-YYYY')
    AND gp.end_date <= TO_DATE ('30/11/2010', 'DD-MM-YYYY')
    AND gcc.account_type IN ('E', 'R'))
    GROUP BY period_name, actual_flag, ACCOUNT, account_description, account_type
    ]]>
    </sqlStatement>
    <sqlStatement name="Q_2">
    <![CDATA[
    SELECT NAME LEDGER_NAME
    FROM gl_ledgers
    WHERE ledger_id =:p_ledger
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="beforeReportTrigger" source="XXX_GL_GLSPF_XMLP_PKG.XXX_GL_SPF_SUMMARY_REP" />
    <dataStructure>
         <group name="G_1" source="Q_1">
                   <element name="account" value="account"/>
                   <element name="account_description" value="account_description"/>
                   <element name="amount_period_range" value="amount_period_range"/>
                   <element name="fisical_ytd_amount" value="fisical_ytd_amount"/>
                   <element name="cumilative_found" value="cumilative_found"/>
                   <element name="account_type" value="account_type"/>
         </group>
         <group name="G_2" source="Q_2">
              <element name="LEDGER_NAME" dataType="varchar2" value="LEDGER_NAME"/>
         </group>
         </dataStructure>
    </dataTemplate>
    Package Specification
    CREATE OR REPLACE PACKAGE APPS.XXX_GL_GLSPF_XMLP_PKG AUTHID CURRENT_USER AS
    -- Package Name : XXX_GL_GLSPFDETAIL_XMLP_PKG
    -- Author's Name : Nihar Ranjan Panda
    -- RICE Object id : GL-REP-05
    -- Purpose : Package Specification
    -- Program Style :
    -- Maintenance History
    -- Date Version# Name Remarks
    -- 28-Nov-2010 1.0 Nihar Ranjan Panda Initial Devp
    --Global Parameters
    p_ledger varchar2(100);
    p_balancing varchar2(10);
    p_start_period varchar2(10);
    p_end_period varchar2(10);
    p_start_fc varchar2(20);
    p_end_fc varchar2(20);
    p_start_site varchar2(10);
    p_end_site varchar2(10);
    p_start_mail_id varchar2(30);
    p_end_mail_id varchar2(30);
    p_purge_history varchar2(10);
    p_where varchar2(1000);
    P_CONC_REQUEST_ID number;
    type spf_ref_cursor is REF CURSOR;
    type rec_spf is record
    account varchar2(20),
    account_description varchar2(100),
    amount varchar2(20),
    account_type varchar2(1),
    currency varchar2(3),
    gl_date varchar2(11),
    je_category varchar2(50),
    code_combination_id varchar2(100),
    line_description gl_je_lines.description%Type,
    batch_name gl_je_batches.NAME%Type,
    je_line_num gl_je_lines.je_line_num%TYPE,
    --transaction_date varchar2(11),
    je_header_num gl_je_headers.je_header_id%Type
    function XXX_GL_SPF_SUMMARY_REP return boolean;
    END XXX_GL_GLSPF_XMLP_PKG;
    Package body
    CREATE OR REPLACE PACKAGE BODY APPS.XXX_GL_GLSPF_XMLP_PKG
    AS
    -- Package Name : XXX_GL_GLSPFDETAIL_XMLP_PKG
    -- Author's Name : Nihar Ranjan Panda
    -- RICE Object id : GL-REP-05
    -- Purpose : Package Body
    -- Program Style :
    -- Maintenance History
    -- Date Version# Name Remarks
    -- 28-Nov-2010 1.0 Nihar Ranjan Panda Initial Devp
    FUNCTION XXX_GL_SPF_SUMMARY_REP
    RETURN BOOLEAN
    IS
    l_min_fc VARCHAR2 (20) := '';
    l_max_fc VARCHAR2 (20) := '';
    l_min_site VARCHAR2 (20) := '';
    l_max_site VARCHAR2 (20) := '';
    l_start_date VARCHAR2 (11) := '';
    l_end_date VARCHAR2 (11) := '';
    BEGIN
    IF p_start_fc IS NULL
    THEN
    SELECT MIN (flex_value)
    INTO l_min_fc
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id =
    (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_FUNCTIONAL_CENTRE');
    p_start_fc := l_min_fc;
    END IF;
    IF p_end_fc IS NULL
    THEN
    SELECT MAX (flex_value)
    INTO l_max_fc
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id =
    (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_FUNCTIONAL_CENTRE');
    p_end_fc := l_max_fc ;
    END IF;
    IF p_start_site IS NULL
    THEN
    SELECT MIN (flex_value)
    INTO l_min_site
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id = (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_SITE');
    p_start_site :=l_min_site;
    END IF;
    IF p_end_site IS NULL
    THEN
    SELECT MAX (flex_value)
    INTO l_max_site
    FROM fnd_flex_values_vl
    WHERE flex_value_set_id = (SELECT flex_value_set_id
    FROM fnd_flex_value_sets
    WHERE flex_value_set_name = 'AHS_SITE');
    p_end_site := l_max_site;
    END IF;
    SELECT TO_CHAR (start_date, 'DD-MM-YYYY')
    INTO l_start_date
    FROM gl_periods
    WHERE period_name = p_start_period;
    SELECT TO_CHAR (end_date, 'DD-MM-YYYY')
    INTO l_end_date
    FROM gl_periods
    WHERE period_name = p_end_period;*/
    p_where := ('AND gcc.segment3 BETWEEN '''|| p_start_fc ||''' AND '''||p_end_fc||''
    AND gcc.segment2 BETWEEN '''|| p_start_site ||''' AND '''||p_end_site||'''
    AND gp.start_date >= '''||TO_DATE (l_start_date,'DD-MM-YYYY')||'''
    AND gp.end_date <= '''||TO_DATE (l_end_date,'DD-MM-YYYY')||''''*/
    RETURN (TRUE);
    EXCEPTION
    WHEN OTHERS
    THEN
    raise_application_error (-20101,NULL);
    NULL;
    END XXX_GL_SPF_SUMMARY_REP;
    END XXX_GL_GLSPF_XMLP_PKG;
    Error file
    Custom Extensions: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    XXGLR005 module: AHS GL SPF Summary Report
    Current system time is 07-DEC-2010 23:39:22
    XDO Data Engine Version No: 5.6.3
    Resp: 20434
    Org ID : 82
    Request ID: 3275555
    All Parameters: p_ledger=2021:p_balancing=101:p_start_period=AUG-10:p_end_period=NOV-10:p_start_fc=71110600018:p_end_fc=71110600018:p_start_site=0006:p_end_site=0006
    Data Template Code: XXGLR005
    Data Template Application Short Name: XXX
    Debug Flag: N
    {p_end_period=NOV-10, p_end_fc=71110600018, p_end_site=0006, p_start_fc=71110600018, p_balancing=101, p_start_period=AUG-10, p_ledger=2021, p_start_site=0006}
    Calling XDO Data Engine...
    [120710_113928978][][STATEMENT] Start process Data
    [120710_113928979][][STATEMENT] Process Data ...
    [120710_113928981][][STATEMENT] Executing data triggers...
    [120710_113928981][][STATEMENT] BEGIN
    XXX_GL_GLSPF_XMLP_PKG.p_ledger := :p_ledger ;
    XXX_GL_GLSPF_XMLP_PKG.p_balancing := :p_balancing ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_period := :p_start_period ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_period := :p_end_period ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_fc := :p_start_fc ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_fc := :p_end_fc ;
    XXX_GL_GLSPF_XMLP_PKG.p_start_site := :p_start_site ;
    XXX_GL_GLSPF_XMLP_PKG.p_end_site := :p_end_site ;
    XXX_GL_GLSPF_XMLP_PKG.p_where := :p_where ;
    :XDO_OUT_PARAMETER := 1;
    END;
    [120710_113928985][][STATEMENT] 1:2021 :
    [120710_113928985][][STATEMENT] 2:101 :
    [120710_113928985][][STATEMENT] 3:AUG-10 :
    [120710_113928985][][STATEMENT] 4:NOV-10 :
    [120710_113928985][][STATEMENT] 5:71110600018 :
    [120710_113928985][][STATEMENT] 6:71110600018 :
    [120710_113928985][][STATEMENT] 7:0006 :
    [120710_113928985][][STATEMENT] 8:0006 :
    [120710_113928985][][STATEMENT] 9:null :
    [120710_113929388][][STATEMENT] Executing data triggers...
    [120710_113929388][][STATEMENT] Declare
    l_flag Boolean;
    BEGIN
    l_flag := XXX_GL_GLSPF_XMLP_PKG.XXX_GL_SPF_SUMMARY_REP ;
    if (l_flag) then
    :XDO_OUT_PARAMETER := 1;
    end if;
    end;
    [120710_113929420][][STATEMENT] p_ledger
    [120710_113929420][][STATEMENT] p_balancing
    [120710_113929420][][STATEMENT] p_start_period
    [120710_113929420][][STATEMENT] p_end_period
    [120710_113929420][][STATEMENT] p_start_fc
    [120710_113929420][][STATEMENT] p_end_fc
    [120710_113929421][][STATEMENT] p_start_site
    [120710_113929421][][STATEMENT] p_end_site
    [120710_113929421][][STATEMENT] p_where
    [120710_113929421][][STATEMENT] Writing Data ...
    [120710_113929426][][STATEMENT] &p_where
    java.lang.NullPointerException
         at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(DataTemplateParser.java:1754)
         at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1473)
         at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:456)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:445)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:308)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:273)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:215)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:254)
         at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(DataProcessor.java:390)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:355)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:334)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:294)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
    Start of log messages from FND_FILE
    End of log messages from FND_FILE
    Executing request completion options...
    Finished executing request completion options.
    Concurrent request completed
    Current system time is 07-DEC-2010 23:39:29
    Could any body please help me fixing this issue...

    Nihaapps,
    It seems like you are missing a default value for p_where. If data templates have the same requirements as RDFs, then lexicals must have a default value that will be valid when the query is verified. The query would have to be checked for validity, and to do that, it has to fill in a value where &p_where is.
    Kurz

  • Run Report with Pass Number and Varchar Lexical Parameter values

    Dear Sir/Madam
    Due to an urgent change required to a report I would most appreciate it if you can please advise me if it is possible to get this report working by either passing in multiple lexical parameters or one signle lexical parameter when calling the SRW.RUN_REPORT command with the following methods:
    Firstly: When calling report with a run_no and spr_cd passed in through one lexical:
    cmd_line: REPORT=D:\DEV\REMITTANCE.rdf BACKGROUND=YES BATCH=NO DESFORMAT=PDF DESTYPE=FILE DESNAME=D:\DEV\REMITTANCE.pdf
    CP_L_PARAM=RUN_NO=TO_NUMBER(28) AND SPR_CD=SUPP1
    Both with a TO_NUMBER and without, whereby I attempt to do a SUBSTR within the query of the called report to derive the RUN_NO Oracle Reports fails to accept the SUBSTR.
    Secondly: I am now trying to call the with passing two lexical parameters into the report as follows:
    cmd_line: REPORT=D:\DEV\REMITTANCE.rdf BACKGROUND=YES BATCH=NO DESFORMAT=PDF DESTYPE=FILE DESNAME=D:\DEV\REMITTANCE.pdf
    CP_L_RUN_NO=||TO_CHAR(lv_run_no)|| CP_L_SPR_CD=||lv_spr_cd;          
    NOTE: The above is an output of the actual command line and not what is passed into the command line, thus the quotes are missing. Please also note that the report is running fine with the only a hard coded RUN_NO value PASSED without the SPR_CD.
    Unfortunately this is also causing issues as the RUN_NO is a number and as you know you can only pass in strings.
    Your urgent help is required on this matter please as our client is expecting a solution this afternoon.
    Hope to hear form you soon.
    Kind regards
    Andrew Mason

    Dont Worry I've worked it out...

  • Problem when using WEB.SHOW_DOCUMENT and passing in lexical parameter

    Hi,
    I got a blank page with error "An error has occured while trying to use this document" when I tried to use web.show_document and passing a lexical parameter to 10g report on 10gAS. The URL in the web.show_document is:
    http://<srvname>:<portnum>/reports/rwservlet?server=repserver90&report=myrpt.rdf&destype=Cache&desformat=pdf&userid=<usr>/<pw>@<db>&where_clause=where%20product_type%20in%20('REPORT')
    If I change the desformat to htmlcss, it is fine to display the report. But doesn't work with desformat=pdf. The pdf file has been generated in the cache. Why can't it display on the screen.
    Also I tried to use double quote the value for where_clause. The pdf report showed up. But it ignored the where clause.
    Experts please help.
    Ying

    I use lexical parameters and they work fine, but I use a parameter list. The code is contained in a form that is called by all forms that wish to run a report. This way you only need the logic for printing in a single form. If you want the form, email me at [email protected]

  • How to define Lexical Parameter in Oracle report.

    Dear all,
    I need to know that how i will define lexical parameter in query of report builder
    i have like this
    SELECT R.EXCEPTION_MESSAGE EXP_MESSAGE,
    ER.PROD_ID PRODUCT,
    ER.TNAME SEGMENT1 ,
    DECODE(R.STATUS,'Y','ROW',
    'L','TABLE',
    'Z','CIB LEVEL',
    NULL) STATUS,
    NVL(COUNT(*),0) CNT
    FROM EXCEPTION_RECORDS ER,CIB_PROC_TABLES_RULES R
    WHERE ER.TABLE_ID=R.CIB_TABLE_ID
    AND ER.EXP LIKE '%'||R.EXCEPTION_MESSAGE||'%'
    AND ER.BRWR=:v_brwr
    &v_where
    GROUP BY R.EXCEPTION_MESSAGE,ER.PROD_ID,ER.TNAME,R.STATUS
    ORDER BY 2
    It is giving an error

    V_WHERE should be defined same way as regular parameter. It should acquire certain value that makes the query syntaxically correct bofore the sql is run, usually in the After Param Form trigger, e.g.
    v_where := 'WHERE 1=1';
    ...

  • Lexical Parameter in subquery?

    Is it possible?
    select * from ( select a,b,c from t where &p_where ) where a>1
    It doesn't seem to like this construct - is there a proper way to do this? p_where will be built based on the parameters selected at runtime.
    Thanks,
    stephan

    Did you supply an initial value for "p_where"? If it is NULL, your sub-query will be invalid because Reports Builder will see it as (note the missing where condition):
    select * from ( select a,b,c from t where  ) where a>1You could supply an initial value such as "1=1", or, you could remove the key word "where" from the subquery and put it in the lexical parameter:
    select * from ( select a,b,c from t &p_where ) where a>1Ah, I see dmars beat me to the punch.
    Message was edited by:
    Brian Hill

  • Lexical Parameter in Oracle Reports . . .

    Hi all,
    I am trying to pass a value to a query in oracle reports . . .
    the use of the parameter is to add 2 additional columns to an existing query, if a bind parameter is set to 'Yes' else the parameter carries a value NULL;
    Here is the code I have written in After Parameter Form:
    if :P_ROLL_DETAIL_PRN='Yes' then
    :P_CUSTOM_CODE:=NULL;
    :P_CUSTOM_CODE:=:P_CUSTOM_CODE||'wdd.LOT_NUMBER' ||','||'wdd.SUBLOT_NUMBER';
    else
    :P_CUSTOM_CODE:='';
    end if;
    P_Roll_detail is the bind parameter . . and P_CUSTOM_CODE is the Lexical Parameter . ..
    It works for value 'No' of P_ROLL_DETAIL .. . but for Value 'Yes' I get an error . . .
    REP-0499: Column '' selected by the query is incompatible with report defination
    Kindly help...
    Regards
    Jagan

    Lexical parameters can not be used to change the number of selected columns. Consider selecting max number of columns always, but populating last two columns with either NULL values or table columns based on the parameter. Also, manipulations can be done in the layout model using format triggers.

  • Lexical parameter in bi report

    Hi All,
    I have a requirement as below :
    I have a select query in my XML file which is returning two rows for a order
    ex: select email,fax,order_number from
    oe_order_headers_all
    hz_contact_points,
    My requirement is i need to pass 3 parameters such as order_number, email, fax to the report in that case it should take only the parameters what i am passing, and it should not take the hz_contact_points table from the query
    so i need to achieve this through lexical parameter, any one please help me on this.
    Thanks

    i think you didn't read that i'm mentioned
    in datatemplate
    <parameters>
    <parameter name="P_YOUR_PARAM" dataType = "number" defaultValue="0"></parameter>
    </parameters>
    <sqlStatement name="Q_DATA">
    <![CDATA[
    select &your_columns
    from  &your_tables
    where &your_where_clause
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="beforeReportTrigger" source="XX_YOUR_PKG.BeforeReport"/>
    <dataStructure>
    ...in package
    FUNCTION BeforeReport RETURN BOOLEAN IS
    BEGIN
    IF P_YOUR_PARAM = 'some_value' THEN
      your_columns := 'column1, column2';
      your_tables := 'table1, table2';
      your_where_clause := 'table1.id = table2.id';
    ELSE
      your_columns := 'column3, column4';
      your_tables := 'table2, table3';
      your_where_clause := 'table2.id = table3.id';
    END IF;
    END;you can use another way - create your xml output by package like
    fnd_file.put_line(fnd_file.output, '<ROWSET>');
    fnd_file.put_line(fnd_file.output, '<ROW>');
    fnd_file.put_line(fnd_file.output, '<DAT>' || some_value || '</DAT>');
    fnd_file.put_line(fnd_file.output, '</ROW>');
    fnd_file.put_line(fnd_file.output, '</ROWSET>');in package you can use all that you want

  • Lexical Parameter in report 10g

    i want to call a report with few fields on my form. i create 2 user parameter which works fine. now i want to create a lexical parameter so that if null no problem report should appear with 2 user parameters but if has values then report should be called according to those parameter values.
    I use this in my form:
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'PBRANCHCODE='||:txtBranchCode||' PPERIOD='||:cmbPeriod||' CLASSCONDITION='||'cla_class_id between 1 and 2'||' paramform=no');
    CLASSCONDITION is a lexical parameter which is called in report sql:
    and periodic_branch_id = :pBranchCode
    and periodic_period_from = :pPeriod
    &ClassCondition
    it says unable to run report
    when i test using paramform=no then it shows in classcondition parameter only and and nothing after space assuming parameter list ended.
    Please help me in passing a lexical parameter to report
    Thanx in advance.

    I want to append the where condition of the report. if values inputed from Form in the class ids from and to text boxes appended as a where condition in the report query otherwise excluded
    Report Query
    select *
    from ...
    where
    and .....
    and ....
    &ClassCondition
    and i want to pass &classcondition parameter the below condition
    and class_id between :fromclass and :toclass
    Hope you understand.

  • Lexical Parameter in Reports 6i Program Unit

    A report I'm writing requires me to use the lexical parameter in a program unit rather than a query in the data model. Lexical parameters in a query have always worked with the example "WHERE &my_parameter". But using "WHERE :my_parameter" or "WHERE &my_parameter" in a program unit gave me the error "expression is of wrong type" so the code wouldn't compile in the editor.
    The parameter returns "segment1 = '8675309' AND segment2 = 'Jenny'I was able to resolve it by using the first column of the expression and the replace function on the parameter so the program unit editor thinks it's a valid expression and the resulting line is a valid predicate that gets the correct data. Here's my example:
    WHERE segment1 = replace(:my_parameter, 'segment1 = ')The replace function strips off the "segment1 = " from the lexical parameter so the resulting line that gets passed to the server is:
    WHERE segment1 = '8675309' AND segment2 = 'Jenny'This solution will not work where the parameter could return something other than "segment1 = " at the beginning of the parameter string like "segment1 BETWEEN " or a different column name to compare other than segment1. Anyway, this is working but if there are better ways to do it I'd like to try them. Using Reports 6i with EBS 11.5.10.2.

    Hello,
    You'll find explanations and examples here :
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwwhthow/whatare/dmobj/sq_a_lexical_references.htm
    This documentation is for Reports 10.1.2 but is valid for Reports 6i too ...
    Regards

  • Generation of XML Tags for columns in Lexical parameter in select query

    Hi,
    I have lexical parameter in my select statement of my data model in the report.
    How do i generate XML tags for these columns inside a Lexical Parameter?
    Simple Example: I have data model query as follows:
    SELECT msi.inventory_item_id
    &LP_SELECT
    FROM mtl_system_items_b
    Here my lexical Parameter LP_SELECT is generated in before report trigger as follows in my report:
    :LP_SELECT := 'msi.segment1,msi.description';
    So, the question is how to generate XML Tags for columns in Lexical Parameter(as in the example above, i need XML tags for these columns - segment1 and description)
    Thanks,
    Ratan

    try this
    Select &order data_show
    from oe_order_headers_all
    where order_number ='7889'
    and setting  :order:='order_number';  in after parameter form trigger.
    Hope this helps
    Hamid

Maybe you are looking for