Lexical References in SELECT

hi,
I'm trying to use a lexical reference in my SELECT statement as follows:
select department_name, department_id, &myParameter from departments
and I'm always getting an error (ORA-00923: FROM keyword not found where expected).
I've already worked with lexical references, but only when constructing the where clause of an SQL statement.
Has anyone of you tried to use it in the SELECT part?
Thanks a lot

Hi Ratnesh,
thanks for your reply ... I tried your solution, but I'm getting the error message (ORA-00923: FROM keyword not found where expected) again.
In the documentation of BI Publisher 10.1.3.2.1 I could read that lexicals are supported for queries against the Oracle E-Business Suite only. Maybe that's the problem? We are NOT using the EBS here.
Here's my data template:
<dataTemplate name="myDataTemplate" defaultPackage="PKG_VC_SECURITY" description="Data Template">     
<lexicals>
<lexical type="oracle.apps.fnd.flex.kff.select" name="LADEDATUM" comment="Comment" application_short_name="INV" id_flex_code="MSTK" multiple_id_flex_num="Y" code_combination_table_alias="msi" segments="ALL" show_parent_segments="Y" output_type="VALUE"/>
</lexicals>
<dataQuery>
<sqlStatement name="ROW" dataSourceRef="">
     <![CDATA[
select sysdate as Date, &LADEDATUMas Ladedatum FROM dual
     ]]>
</sqlStatement>
</dataQuery>
<dataTrigger name="beforeReport" source="PKG_VC_SECURITY.fun_context_setzen(:pUSERID, :pUSERGROUP, :pSID)"/>
</dataTemplate>
Any further ideas? ;-)

Similar Messages

  • Lexical References in oracle.apps.fnd.flex.kff.select

    Hi,
    I have one XML report and I am trying to Implement the Lexical References in Select.
    The bellow Code I wrote under <Lexical> tag
    <lexical type="oracle.apps.fnd.flex.kff.select" name="C_dest_locator_value" application_short_name="INV" id_flex_code="MTLL" id_flex_num=":P_STRUCT_NUM" segments="ALL" code_combination_table_alias="mil" multiple_id_flex_num="N" show_parent_segments="Y" output_type="VALUE"/>
    But in the Data It is retrieving as
    <C_DEST_LOCATOR_VALUE>fnd_flex_xml_publisher_apis.process_kff_combination_1(&apos;C_dest_locator_value&apos;, &apos;INV&apos;, &apos;MTLL&apos;, 101, mil.ORGANIZATION_ID, mil.INVENTORY_LOCATION_ID, &apos;ALL&apos;, &apos;Y&apos;, &apos;VALUE&apos;)</C_DEST_LOCATOR_VALUE>
    And in the RTF template I wrote the code as
    <?if:not(contains(C_DEST_LOCATOR_VALUE,'fnd_flex'))?><?C_DEST_LOCATOR_VALUE?><?end if?>
    But It is not displaying any thing. Any one has any clue what was went wrong on this.
    Please help me on this As one deliverable is pending .
    Thanks
    Nihar

    What is your application release?
    Not sure if I understand you correctly, but have you reviewed (How To Use Oracle.Apps.Fnd.Flex.Kff.Select To Retrieve Particular Segments And Not All Segments from a Flexfield [ID 1267032.1]) and see if it helps?
    Thanks,
    Hussein

  • "Index: 0, Size: 0" error when using lexical references

    I got "Index: 0, Size: 0" when using lexical references in data template. Can any body tell me what happen? The detail error is:
    [042308_084608187][][EXCEPTION] java.lang.IndexOutOfBoundsException: Index: 0, S
    ize: 0
    at com.sun.java.util.collections.ArrayList.RangeCheck(ArrayList.java:492
    at com.sun.java.util.collections.ArrayList.get(ArrayList.java:306)
    at oracle.apps.xdo.dataengine.DataTemplateParser.getParentDataSource(Dat
    aTemplateParser.java:1802)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeDefaultGroup(XMLPGEN.java:329
    at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:2
    84)
    at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:271)
    at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:213)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:252)
    at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(DataProc
    essor.java:390)
    at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.ja
    va:355)
    at oracle.apps.xdo.servlet.data.bind.AdvancedQueryBoundValue11.callDataP
    rocessor(AdvancedQueryBoundValue11.java:212)
    at oracle.apps.xdo.servlet.data.bind.AdvancedQueryBoundValue11.getValue(
    AdvancedQueryBoundValue11.java:101)
    at oracle.apps.xdo.servlet.ReportContextImplV11.getReportXMLData(ReportC
    ontextImplV11.java:399)
    at oracle.apps.xdo.servlet.CoreProcessor.process(CoreProcessor.java:143)

    Here is the data template, the lexical reference is &where_clause, thanks.
    <dataTemplate name="Tamplate" dataSourceRef="dmdb" defaultPackage="RRBY_PKG">
         <properties>
              <property name="debug_mode" value="on"/>
         </properties>
         <parameters>
                   <parameter name="BUName" dataType="character"/>
              <parameter name="StartDate" dataType="date"/>
              <parameter name="EndDate" dataType="date"/>
         </parameters>
    <dataTrigger name="beforeReport" source="RRBY_PKG.dynamic_where(BUName =&gt; :BUName)"/>
         <dataQuery>
         <sqlstatement name="GroupByAgent">
                   <![CDATA[SELECT
      NVL(businessunit.name, 'Unassigned') UNITNAME,
      queue.name QUEUENAME,
      NVL2(businessunit.name, 'Unassigned', businessunit.name || ': ' || queue.name) FULLQUEUENAME,
      COUNT(queueEvent.requestNumber) REQNUM
    FROM((((queueevent queueevent
    INNER JOIN assignment assignment ON queueevent.assignmentkey = assignment.assignmentkey)
    INNER JOIN datedim datedim ON queueevent.datekey = datedim.datekey)
    INNER JOIN businessunit businessunit ON queueevent.businessunitkey = businessunit.businessunitkey)
    INNER JOIN queue queue ON queueevent.forwardedqueuekey = queue.queuekey)
    INNER JOIN timedim timedim ON queueevent.timekey = timedim.timekey
    WHERE dateDim.FULLDATE >= TO_DATE(:StartDate, 'yyyy-mm-dd')
    AND BW_COMMON_DATEADD('s', timeDim.SECONDOFDAY, BW_COMMON_DATEADD('s', queueEvent.EVENTDURATION, dateDim.FULLDATE)) > TO_DATE(:StartDate, 'yyyy-mm-dd')
    AND BW_COMMON_DATEADD('s', timeDim.SECONDOFDAY, BW_COMMON_DATEADD('s', queueEvent.EVENTDURATION, dateDim.FULLDATE)) &lt; TO_DATE(:EndDate, 'yyyy-mm-dd') AND &where_clause
    group by businessunit.name, queue.name]]>
              </sqlstatement>
         </dataQuery>
    </dataTemplate>

  • URGENT: Problem with lexical reference in query statement!

    I am modifying the seeded Receipt Traveler report.
    The query I need to modify is the receipts query (Q_RECEIPTS). The entire query statement for this is a lexical reference - &P_SELECT_RECEIPTS. The actual query is being set in the After Parameter Form trigger. I need to add a few columns to the select clause and tables to the from clause. Modifying the query in the trigger alone did not help. I got the error - REP 0498 "selected columns differ from report definition"
    => How do I add these new columns to the report now? Do I need to put them in the initial value of the parameter &P_SELECT_RECEIPTS?
    => I tried modifying P_SELECT_RECEIPTS, but I get a REP 1070 error saying the file cannot be saved.
    => In addition, P_SELECT_RECEIPTS does not have a from clause, which causes a problem for me, but I am wondering how the report was originally saved
    Any help with this rather lengthy question will be greatly appreciated.
    Thanks,
    P.S.
    The initial value of &P_SELECT_RECEIPTS is set to:
    SELECT rrp.item_id,rrp.organization_id rrp_organization_id,MSI.SEGMENT1||''||MSI.SEGMENT2||''||MSI.SEGMENT3||''||MSI.SEGMENT19||''||MSI.SEGMENT20 C_FLEX_ITEM,MCA.SEGMENT1||''||MCA.SEGMENT2||''||MCA.SEGMENT3||''||MCA.SEGMENT19||''||MCA.SEGMENT20 C_FLEX_CAT,rrp.revision_num,rrp.category_id,rrp.item_description,rrp.un_num,rrp.un_description,rrp.hazard_class,rrp.routing_name,rrp.document_type_code,rrp.document_number,rrp.release_num,rrp.line_num,rrp.buyer_preparer_name,rrp.source_type,rrp.source,rrp.source_unit_of_measure,rrp.vendor_product_num,fnd_date.date_to_canonical(rrp.due_date) due_date,round(rrp.quantity_ordered,:P_qty_precision) quantity_ordered,rrp.note_to_receiver,rrp.pll_note_to_receiver,decode(psp.manual_receipt_num_type,'ALPHANUMERIC',rrp.receipt_num,decode(rtrim(rrp.receipt_num,'0123456789'),NULL,to_number(rrp.receipt_num),rrp.receipt_num)) RECEIPT_NUM,rrp.receipt_unit_of_measure,fnd_date.date_to_canonical(rrp.receipt_date) receipt_date,rrp.receipt_location,rrp.receiver_first_name,rrp.receiver_last_name,rrp.freight_carrier,round(rrp.quantity_received,:P_qty_precision) quantity_received,rrp.primary_quantity parent_primary_quantity,round(rrp.quantity_remaining,:P_qty_precision) quantity_remaining,rrp.shipment_num,rrp.bill_of_lading,rrp.vendor_lot_num,rrp.packing_slip_num,rrp.containers,rrp.receiver_comment,rrp.transaction_type rrp_transaction_type,rrp.transaction_id rrp_transaction_id,rrp.shipment_line_id rrp_shipment_line_id,rrp.shipment_header_id rrp_shipment_header_id,rrp.distribution_id rrp_distribution_id,rrp.po_header_id,rrp.po_line_id,rrp.po_line_location_id,rrp.requisition_header_id,rrp.requisition_line_id,rrp.from_interface rrp_from_interface,rrp.deliver_to_location,rrp.license_plate_number

    You can see the query being bulit within the BUILD_QRECIEPTS Program Unit

  • LEXICAL REFERENCES IN STORED PROCEDURES

    CAN I TO DO LEXICAL REFERENCES IN STORED FUNCTIONS AND STORED
    PROCEDURES ?
    THANK'S FOR ANY HELP.

    What is your application release?
    Not sure if I understand you correctly, but have you reviewed (How To Use Oracle.Apps.Fnd.Flex.Kff.Select To Retrieve Particular Segments And Not All Segments from a Flexfield [ID 1267032.1]) and see if it helps?
    Thanks,
    Hussein

  • Challenging Lexical Reference and SQL Problem

    Hi,
    I am trying to build a product hierarchy master report but I have a challenging problem at hand. To generate the report I need an SQL statement with lexical references and before parameter form. Basically, my SQL statement looks something like this:
    Select &Columns
    From &Tables
    Where &Criteria
    Before Parameter:
    In If X='1',
    &Columns := A.NAME, B.NAME, C.NAME
    &Tables:=A,B,C
    &Criteria:= A.CODE=B.CODE, B.CODE=C.CODE
    In If X='2',
    &Columns := A.NAME, B.NAME, C.NAME, D.NAME
    &Tables:=A,B,C,D
    &Criteria:= A.CODE=B.CODE, B.CODE=C.CODE,C.CODE=D.CODE
    In If X='3',
    &Columns := A.NAME, B.NAME, C.NAME, D.NAME, E.NAME
    &Tables:=A,B,C,D,E
    &Criteria:= A.CODE=B.CODE, B.CODE=C.CODE,C.CODE=D.CODE, C.CODE=E.CODE
    I need to build a group left report and group by A,B and up to E if X='3'.
    Any idea how can I accomplish this? Any kind of help or advice is urgently needed. Thank you in advance.

    Siak,
    build a kind of maximum modell. Set the initial values of your Parameters to the maximum (like for columns:
    a.name as aname, b.name as bname, ...., e.name as ename)
    and build a layout for this. Then in a before report trigger set the paramters you want and fill the not needed with dummy values. For example if X=1 then
    :columns := 'a.name as aname, b.name as bname, c.name as cname, ''x'' as dname, ''x'' as ename'
    In the layout supress the output of non used fields with a format trigger or use dependent from your X three different layouts. I've not tested it, but it's a chance ...
    regards
    Rainer

  • Report Builder: Lexical References

    I need to use a lexical reference for the whole sql statement in one of the quries of my report since I have multiple clauses. For example I'm using
    select &depttable
    where depttable is a user parameter. According the the help of the Report Builer this is possible but it is reporting an error of missing expressing when closing the query boc. I'm really confused now and this is the only way possible. Can anyone help please?

    It is easy. You can declare a lexical parameter for the whole query, but you have to enter an initial value for the parameter
    which restricts the number and datatypes of output columns.
    Declare the parameter (1 parameter for the whole Select) before you open the query editor.
    You have to decide on the number and datatypes of the columns in the select clauses of the statements
    you are going to use with this report.
    Assuming the Statements will use one number and one character column in their select clauses:
    Declare the parameter for the whole query as follows:
    datatype character
    width 500 (depending on how long your queries can get)
    initial value: write any select that contains a select and a from clause (must be a parsable statement)
    The select clause must (to fit this example) contain a number and a character column in the correct order.
    Write for example: SELECT EMPNO,ENAME FROM EMP. (assuming you have EMP table in your schema)
    Then open the query editor and write the parameter name with a leading&. (f.e.: &p_1)
    When you close it , Reports parses the query with the initial value for the parameter and saves information on the output columns.
    Design a layout. You will then be able to run the report with any SELECT that outputs a number and char column (in the correct order)
    For example: select deptno,dname from dept where deptno< 40 order by deptno desc.

  • Lexical reference issue in EBS

    Hi All,
    I have an XML file with the lexical reference. When I run the report in EBS it gives me Invaild Identifier error.
    Following is the the .xml
    <?xml version="1.0" ?>
    <dataTemplate name="Programs" description="Report" defaultPackage="part_date_range" version="1.0">
    <parameters>
    <parameter name="p_part_from" dataType="character"/>
    </parameters>
    <lexicals/>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[
    SELECT
    msi.concatenated_segments,
    SUBSTR (msi.description,1,70) dana_part_desc
    FROM
    apps.mtl_system_items_kfv msi
    WHERE
    &lpdpartnum 'FBPTP30036'
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="afterParameterForm" source="part_date_range.part_range"/>
    </dataTemplate>
    Package:
    CREATE OR REPLACE PACKAGE part_date_range AS
    FUNCTION part_range --(p_part_from in Varchar2)
    RETURN BOOLEAN;
    lpdpartnum varchar2(1000);
    p_part_from varchar2(40);
    END part_date_range;
    CREATE OR REPLACE PACKAGE BODY APPS.part_date_range AS
    function part_range return BOOLEAN is
    begin
    Fnd_File.Put_Line(Fnd_File.LOG,'***********This is the error1***'||p_part_from||'######');
    if
    p_part_from is not null then
    Fnd_File.Put_Line(Fnd_File.LOG,'***********This is the error2***');
    lpdpartnum :=' msi.concatenated_segments BETWEEN p_part_from AND';
    Elsif
    p_part_from is null then
    lpdpartnum :=' msi.concatenated_segments <=';
    End if;
    Fnd_File.Put_Line(Fnd_File.LOG,'***********This is the error3***');
    return (TRUE);
    end part_range;
    END part_date_range;
    Parameter value
    p_part_from: FBPTP30018
    Following is the Error message:
    Debug Flag: N
    {p_part_from=FBPTP30018}
    Calling XDO Data Engine...
    java.sql.SQLException: ORA-00904: "P_PART_FROM": invalid identifier
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:850)
         at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2599)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2963)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:584)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeDefaultGroup(XMLPGEN.java:382)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:279)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:266)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:205)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:237)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:364)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    Start of log messages from FND_FILE
    ***********This is the error1***FBPTP30018######
    ***********This is the error2***
    ***********This is the error3***
    End of log messages from FND_FILE
    I dont know what I am doing worng.. Any pointers will be greatly appriciated.
    Thanks in Advance....

    Instead of this:
    lpdpartnum :=' msi.concatenated_segments BETWEEN p_part_from AND';try this:
    lpdpartnum :=' msi.concatenated_segments BETWEEN '''||p_part_from||''' AND';

  • Size Constraints of Lexical Reference Types/Dynamic Queries

    Can any Oracle guru's tell me what the maximum length is for a Lexical Reference.
    Our project here reads a dynamic sql statement from a table that has been parsed into four seperate columns. We load this into four User Parameters p_select1, p_select2, p_select3, and p_select_4. All are defined as varchar2(2000).
    The query in the data model looks like this.
    &p_select1
    &p_select2
    &p_select3
    &p_select4
    These queries can get quite large. Sometime if it is too large and you run the report it dies a horrible death.
    I have read somewhere that the select statement cannot exceed 64k but, I don't know how this relates to how much you can fit into each line of the query.
    Hopefully, that makes sense.
    Thanks,
    Bob

    I should add that we are on Reports6 and Oracle 8. Thanks

  • Lexical References for reports 9i (graph and colors)

    hi,
    1) i want to use lexical parameters for graph and colors
    like font,background,foreground,text and so on....
    for graph :
    width,height,x-axis,y-axis and so on....
    my reports are saved in .jsp .
    it is possible or not .if possible please help me.
    it's very urgent.
    2) I have created a report with graph at the beginning of the first page
    I got result with graph and corresponding data in tabular format and saved in .jsp file.
    Graph is shown at the beginning of the report as I desired followed by
    data.(i.e. First Page).
    From next page I am not able to get the data
    from the top of the page instead a gap with the size of the graph is available
    which is blank.
    I need to produce graph only on the first page and the other pages with just the
    data without a gap reserved for graph.
    with regard's
    vijay

    1) Yes, you can use lexical references in the generated graph XML (I presume that you're talking about 9i). However, this functionality is only available in patch 1 and above (patch 2 is now available, and can be downloaded from Metalink).
    2) Create a frame around the graph (and make sure that the graph is contained by the frame, i.e., move it forwards). Make the frame vertically variable.
    Hope this helps,
    Danny

  • Lexical reference on table during reports runtime

    Friends,
    I have to create a report that must run the details for a specific period passing the period as parameter during runtime option. The parameter for the period given should be linked with that of table name like abc_200701, abc_200702 where the lexical reference referred to "abc_period" and corresponding month details from that table has to be fetched.
    Please tell, what are the steps to be taken to initialise the lexical reference for the table to fetch data.

    You can find a great solution right [url http://forums.oracle.com/forums/forum.jspa?forumID=84]Here
    Regards,
    Tony
    Message was edited by:
    Tony Garabedian

  • [svn:fx-trunk] 11535: Don't early bind lexical references in a with block.

    Revision: 11535
    Author:   [email protected]
    Date:     2009-11-06 13:50:52 -0800 (Fri, 06 Nov 2009)
    Log Message:
    Don't early bind lexical references in a with block. It causes
    outer locals to shadow properties on the with object.
    (bug ASC-2257; r=peted)
    Ticket Links:
        http://bugs.adobe.com/jira/browse/ASC-2257
    Modified Paths:
        flex/sdk/trunk/modules/asc/src/java/macromedia/asc/semantics/FlowAnalyzer.java

    This line:
    Jul 30 18:34:00 sleepy dhclient: wmaster0: unknown hardware address type 801
    According to your kernel log, your wireless card is wlan0.  I'm not sure what wmaster0 is, but I'm pretty sure that's the network device causing the issue here; NetworkManager can be pretty finicky when your network configuration is not correct.

  • Field References, Field Selection Group & Screen Sequence

    Dear Experts,
      Please whare are the importance of field References,  Field Selection group  & Screen Sequence? How do i use them?

    Hi,
    These are Object based (Like Material master, BOM, Routing etc..), so depending on how you want the screen layout and how you want the mandatory/optional field defination you can define it here.
    Regards,
    Prasobh

  • 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

  • &param lexical variable in SELECT clause

    Is there a way to get Oracle*Reports to accept a lexical variable in the SELECT clause? The example is:
    SELECT
    table.column1,
    table.column2,
    &PARAM as column3
    FROM
    table
    I am already using lexical variables in the WHERE clause, but getting one to work in the SELECT clause has thus far failed.
    The SQL is accepted if :PARAM is used in place of &PARAM, but I am unable to actually vary the selected column this way.
    The bind variable PARAM has the following code behind it in a BeforeReport trigger:
    IF :ANOTHER_PARAM := 'ALL' THEN
    :PARAM = 'ALL'
    ELSE
    :PARAM = 'table.column3'
    When using :PARAM in the SELECT clause, the literals 'table.column3' are returned, not the contents of table.column3.

    Sorry for the wasted bandwidth. I found a solution. Here it is:
    SELECT
    table.column1,
    table.column2,
    CASE :P_USER
    WHEN 'ALL' THEN 'ALL'
    ELSE table.column3
    END as column3

Maybe you are looking for