Use of variable to generate a report

Hi,
Can anyone help!
I've created a selection list with submit, which displays a list of applications, the return value is the name of the remote database table which holds exceptions associated to the chosen application. This is in a html region called Database Selection and the return is P4_APPLICATIONS (e.g. aps_monitor_excp_codes@eds.
I then have a report in a region called Exceptions which must used the supplied database name in the from. Here is the source, when I change the table variable back to a literal it works so the problem must be with how or where I'm using the variable.
declare
v_return varchar2(4000);
begin
v_return := 'Select SortOrder, ExceptionSequence, DateStamp, Priority, ProcessID, ExceptionCode, ShortMsg, FullDesc, ProcessName, ExceptionObject, ErrorDetails, Action, apex_item.checkbox(1,Acknowledged, decode(Acknowledged,''Y'',''CHECKED'',Null)) Acknowledged
from (SELECT upper(nvl(a.exception_acknowledged_yn,''N'')) SortOrder,
a.exception_sequence_number ExceptionSequence,
a.exception_timestamp DateStamp,
decode(b.priority, ''A'', ''HIGH'', ''B'', ''MEDIUM'', ''C'', ''LOW'', ''D'', ''INFO'', ''UNKNOWN'') Priority,
a.unix_pid ProcessID,
a.exception_code ExceptionCode,
htf.escape_sc(b.short_exception_message) ShortMsg,
htf.escape_sc(b.full_description) FullDesc,
a.process_name ProcessName,
a.exception_object ExceptionObject,
htf.escape_sc(a.exception_detail) ErrorDetails,
htf.escape_sc(b.action) Action,
upper(nvl(a.exception_acknowledged_yn,''N'')) Acknowledged
FROM :P4_APPLICATIONS a, monitor_excp_codes@eds b
WHERE a.exception_code = b.exception_code (+))
order by 1, 2 desc';
return v_return;
end;
Any help would be appreciated, if I have to ask my colleagues I'll get a blonde joke!
Thanks
Becks

You can't use bind variables in place of table names in SQL. Change it to:
...FROM ' || :P4_APPLICATIONS || 'a ...
Scott

Similar Messages

  • Using Bind variables in SQL PLUS Report

    using Bind variables in SQL PLUS Report. This report gets the arguments from the application concurrent program. Now my need is to convert the start_date and end_date to bind Variables to improve the performance. I have commented the original code in 'prompt List of Unapproved Adjustments' and used my Bind Variable but it is giving an error
    error: Bind Variable "ENDING_DATE" not declared
    Report Date and Time:
    26-OCT-2010 15:44:13
    List of Unapproved Adjustments
    Bind Variable 'ENDING_DATE" not declared
    Please see below the code for the sql plus report:
    define p_org_id           = '&1'
    define p_fy_begin_date = '&2'
    define p_start_date = '&3'
    define p_end_date = '&4'
    define p_conversion = '&5'
    declare
    variable begin_date date;
    exec :begin_date := p_start_date;
    variable ending_date date;
    exec :ending_date := p_end_date;
    /* Begin
    :begin_date := to_date('&p_start_date','YYYY/MM/DD HH24:MI:SS');
    :ending_date := to_date('&p_end_date','YYYY/MM/DD HH24:MI:SS');
    End; */
    set newpage none
    set termout off
    set pagesize 55
    set linesize 180
    set heading on
    set feedback off
    set wrap off
    set space 1
    set heading on
    begin
    dbms_application_info.set_client_info('&p_org_id');
    end;
    prompt
    prompt Report Date and Time:
    prompt ----------------------
    select to_char(sysdate,'DD-MON-YYYY HH24:MI:SS')
    from dual ;
    prompt
    prompt List of Unapproved Adjustments
    prompt -------------------------------
    select b.trx_number,
    a.adjustment_number,
    f.user_name created_by
    from apps.ar_adjustments a,
    apps.ra_customer_trx b,
    apps.fnd_user f
    where a.customer_trx_id = b.customer_trx_id
    and a.status <> 'A'
    and a.created_by = f.user_id
    and a.creation_date between :begin_date
    and :ending_date
    -- and a.creation_Date between to_date('&p_start_date','YYYY/MM/DD HH24:MI:SS')
    -- and to_date('&p_end_date','YYYY/MM/DD HH24:MI:SS')
    order by
    b.trx_number ;

    Hi
    Please go to customization part of the report and verify..You have set a default value out there ..And also verify your lov and look at the values ..If it is again giving you the problem ..pl delete the report and develop it again from the scratch it will be solved...
    vishnu
    null

  • Using bind variables in a portal report

    I'm using a portal 3.0.9 report with bind variables.
    I also use LOV to let the user choose his own parameters for these variables.
    When user click Apply on the customization form of the report, the selection is always "set to default"

    Hi
    Please go to customization part of the report and verify..You have set a default value out there ..And also verify your lov and look at the values ..If it is again giving you the problem ..pl delete the report and develop it again from the scratch it will be solved...
    vishnu
    null

  • Re: Use of Variables in Formula (GRR3 Report)

    Hello,
    I have defined a report in the GRR3 transaction (Report writer) and am trying to use a variable in one of the columns. By reading the advice, it says you can enter the variable (0F-RP00 for example) as '&0F-RP00' and it should work, i am doing this but it keeps on telling me that it is incorrect. Can anybody tell me what i may be missing?
    regards,
    Stepheh

    The Variable is created of course. In fact, its standard 0F-RP00.

  • Using bind variables in Shared Component Reports not working

    I've created a report query as a shared component in my APEX application. I'm calling the report on a page via a button. The query behind the report has bind variables for period and entity fields which are both defined on Page 0. I can run the query and return values just fine, but when you run the report from the page via the button, I get no values back. Does anyone know a trick to getting this to work? I've been working in APEX for about a month and I don't have much developer experience so any help is appreciated.
    Regards,
    -Steve

    Rohit,
    Thanks for your response. We are using APEX version 4.2.1.00.08. I do have Session State enabled and have put the required page items in the list. Here is my report query (highlighted lines contain the bind variables):
    SELECT TAX_DIVISION.DIVISION_CODE Division,
    TAX_ENTITY.ENTITY_CODE Entity_Code,
    DECODE(TAX_ADJUSTMENT.CATEGORY_DESC,'Net Income/(Loss)',1,'Permanent Adjustment',2,'Temporary Adjustment',3,4) Category_Desc,
    TAX_ADJUSTMENT.CLASSIFICATION Classification,
    TAX_ADJUSTMENT.ADJUSTMENT_CODE Adjustment_Code,
    SUM(NVL(NVL(TAX_ENTITY_ADJUSTMENT.OVERRIDE_AMT,TAX_ENTITY_ADJUSTMENT.ADJUSTMENT_AMT),0)) Tax_Amount
    FROM TAX_DIVISION,
    TAX_ENTITY,
    TAX_ENTITY_ADJUSTMENT,
    TAX_ADJUSTMENT,
    TAX_PERIOD
    WHERE TAX_DIVISION.DIVISION_ID = TAX_ENTITY.DIVISION_ID
    AND TAX_ENTITY.ENTITY_ID = TAX_ENTITY_ADJUSTMENT.ENTITY_ID
    AND TAX_ENTITY_ADJUSTMENT.ADJUSTMENT_ID = TAX_ADJUSTMENT.ADJUSTMENT_ID
    AND  TAX_ENTITY_ADJUSTMENT.PERIOD_ID = :P0_PERIOD_ID
    AND  TAX_ENTITY_ADJUSTMENT.YEAR_ID = :P0_YEAR_ID
    AND  TAX_ENTITY.DIVISION_ID = :P0_DIVISION_ID
    AND TAX_ADJUSTMENT.ADJUSTMENT_CODE = 'IBIT'
    GROUP BY TAX_DIVISION.DIVISION_CODE ,
    TAX_ENTITY.ENTITY_CODE ,
    DECODE(TAX_ADJUSTMENT.CATEGORY_DESC,'Net Income/(Loss)',1,'Permanent Adjustment',2,'Temporary Adjustment',3,4),
    TAX_ADJUSTMENT.CLASSIFICATION ,
    TAX_ADJUSTMENT.ADJUSTMENT_CODE
    HAVING SUM(NVL(NVL(TAX_ENTITY_ADJUSTMENT.OVERRIDE_AMT,TAX_ENTITY_ADJUSTMENT.ADJUSTMENT_AMT),0)) !=0
    ORDER BY DIVISION_CODE, DECODE(TAX_ADJUSTMENT.CATEGORY_DESC,'Net Income/(Loss)',1,'Permanent Adjustment',2,'Temporary Adjustment',3,4), CLASSIFICATION, ENTITY_CODE, ADJUSTMENT_CODE
    The query returns data when I set the bind variables and test in the report queries screen. When I assign the report query URL to the button in the application and run from there, I get no results.

  • Using bind variables in user defined reports

    How do I go about using a bind variable in a user defined report?
    Here's a trivial example in SQL*Plus:
    var ublocksize number
    begin
    select value into :ublocksize
    from v$parameter
    where name = 'db_block_size';
    end;
    select :ublocksize from dual;
    This code does not work in raptor.
    The error displayed is:
    Missing IN or OUT parameter at index:: 1
    Vendor code 17041
    any ideas?

    You also have a second issue of supporting the following syntax in SQL scripts:
    var ublocksize number
    begin
    select value into :ublocksize
    from v$parameter
    where name = 'db_block_size';
    end;
    We are itterating to support all SQL plus commands
    Mike

  • How to declare and use a variable in BI Publisher report

    Hi Experts ,
    I have to groups of serial numbers and both group are put in same table and same row one after another , and i have a condition that if no serial number is present in both group than the line of that table should not be appeared ,i used the condition region ,biut this condition region is working in single group case if i put both groups together ,the blaing line appears with its label ,I think if i will have have variable which can count the total present of serial number than I cant put a single condition ,would you please help me ,how can I declare a variable and how can i count the number of serials in both groups ,please find below the example
    <grp1><?SR_NUM1?><end of grp1> <grp2><?SR_NUM2?><end of grp2>
    above example is how i am printing now ,now i need a combined condition where if bot group do not contain any value then this blank line should not appear . thanks in advance.
    Thanks
    Pratap

    Hi ,
    Decalring the Varible :
    <?xdoxslt:set_variable($_XDOCTX, 'var', 0)?>
    Do the calculation :
    <?xdoxslt:set_variable($_XDOCTX,'var', xdoxslt:get_variable($_XDOCTX,'var‘)+ XML columnname)?>
    Display the Variable :
    <?xdoxslt:get_variable($_XDOCTX, 'var')?>
    Declare the varaible before your loop starts.Do the calculation part inside the loop so for each row it will be updated.
    Display the results where you want using the form field and place the display varaible syntax.
    Hope this will helpful for you.
    Thanks,
    Ananth

  • How to generate AWR report by using ttStats?

    Hi all,are there any links or documents to show how to use ttStats toolkit to generate a report like Oracle AWR report?
    If no links or document available, could you tell me how to use it?
    In fact I want to know how to do a performance analysis for my application and perform some tune.
    If any other toolkits are more suitable please let me know and of course the guide that how to use them is much welcome.
    Thanks.

    The ttStats executable can be found in the <TimesTen_home>/support directory. Before you can run the executable within a command prompt, you'll need to source the ttenv.* file in the <TimesTen_home>/bin directory.
    The output of ttStats -h is as follows:
    ttStats [-latchstats on|off] [-display-options] [-xml file]
    [-statlevel level] <dsn or connstr>
    ttStats -s[napshot] [-latchstats on|off] -xml <file> <dsn or connstr>
    ttStats -report <xmlfile1> <xmlfile2> <-text|-html> <report_file>
    Where parameters in <> are required, and in [] are optional.
    -display-options:
    This option only works in monitoring mode as
    screen filtering. ttStats only displays on the
    screen statistics with specified prefixes.
    Available prefix options include:
    -cg, -ckpt, -conn, -db, -grid, -lock, -log, -repl,
    -stmt, -txn, -xla, -zz, where the naming of prefixes
    conforms to naming of statistics in TimesTen
    sys.systemstats table. If no display option
    is specified, all statistics are displayed
    by default. For example, run command
    ttStats -cg -stmt dsn=TptbmData
    to display only cache group and statement
    related statistics.
    -h[elp] Print help message and exit.
    -interval <secs> Collect a set of statistics every <secs> seconds
    (default=10).
    Note: setting this lower can negatively impact
    performance
    -xml <file> Write statistics to <file> in XML format. All
    statistics will be written to <file> no matter
    whether they are displayed on screen or not.
    For example ttStats -xml mon.xml dsn=TptbmData
    and ttStats -xml mon.xml -cg dsn=TptbmData
    write the same file even if the latter only
    shows cache related statistics on the screen.
    -snapshot One snapshot of all statistics are saved to disk
    in the specified file format, then the program
    exits. This option should be used together with
    the -xml option.
    -statlevel <level>
    Set the SysStats level, this value of level only
    applies to sys.systemstats table.
    -report <xmlfile1> <xmlfile2> <-xml|-text|-html> <report_file>
    Compare two snapshots, and generate an AWR like
    report. At present, each XML file contains only
    one snapshot. The difference is computed as the
    absolute value of statistic value in <xmlfile2>
    minus that in <xmlfile1>. The result can be
    written in HTML and plain text formats. XML is
    not supported as output format at present.
    As an example, you can run the utility as the instance admin user by doing something like:
    ./ttStats -s -xml tmp.xml <DSN>
    You can then open tmp.xml with a web browser and see statistics about the database.
    You can also compare two previously captured snaps by doing something like:
    ./ttStats -report tmp1.xml tmp2.xml -html tmpReport.html

  • ALL variables in one single report

    Hi Experts,
    I have one requirement, i am creating report on multi provider , so i have to create report to include all variable and it's definition(for wht purpose the variables are created means with description in report.).
    So is there any posibility Please explaine me clearly how we crarte report on all variables.
    Thanks in advance
    Bharati

    Hi Bharati,
    Still not clear about the requirement ......
    There is a table for variable name and its description been stored.  Please do generic extraction using table of view and load data to cube.  then generate a report on top of it.  But purpose of variable may be differ for each report , identifying of the purpose of the variable not possible with out manual intervention.   eg. i have calmonth variable reference to document data which ready for input .. using the same I am deriving a customer exit variable to populate ytd or mtd how will you analyze this ??  if I want to use same variable to any other report which used to used as it is based on doc date..
    Thanks
    BVR

  • Generate PDF report with HTML data

    Hi All,
    I am using BI Publisher to generate my reports but I stumbled on a big problem...
    I have a table with a column TASK_DESCRIPTION. This column is a CLOB containing a simple HTML coded page. When a user works with the application he sees a nicely formatted page but when I generate a report I get all the html tags in it (< html > < h4 > ...etc...)
    Is it possible to somehow convert the source data from the table (which is html code) into readable formatted text when generating the report?
    ANY ideas are very welcome!
    Regards,
    Pawel.

    Yes you can do this with an XSL template converting HTML to Formatting objects.
    There are a few catches however. First, you must be sure your markup-fragment is valid XHTML, that is all tags must be closed. Luckily the builtin standard HTML-editor does this.
    I wasn't able to call BI-publisher from within Apex without the XHTML-fragment being escaped, but i managed to create a query on a table containing the fragment within BI-publisher itself. This leaves the fragment intact, producing a valid XML-document.
    This is very important because the XSL attached to the RTF-template must be able to match and convert the XHTML-tags to FO.
    Basic setup :
    Create a datasource (query) within BIP.
    Create the RTF-template and add an extra field (at the top) containing : <?import:file:///C:\xhtml-to-xslfo.xsl?> or whatever location the XSL-file resides.
    Now, layout your report using the wizard and change the field containing the XHTML-fragment into <xsl:apply-templates select="TASK_DESRIPTION"/>
    There are a few XSL-templates out there converting XHTML to FO. One I found particularly useful : http://www.ibm.com/developerworks/library/x-xslfo2app/xhtml-to-xslfo.xsl
    You might want to change the .xsl so it matches tags case insensitive (eg. <xsl:template match="a|A"> )
    Another caveat is the html-entities for special characters. When the XML from the datasource is parsed by BIP it doesn't recognise entities like &Agrave ; .
    This can be solved by creating a pl/sql function converting these characters to numeric entities like &#192 ;. and use this function in the select statement of your datasource. see http://www.w3schools.com/tags/ref_entities.asp
    Now you can call the report from Apex using an URL to the report definiton (see BIP docs for URL syntax and parameter passing)
    Not a 'really' integrated solution but I had some nice results.
    It would be nice though if we could specify a .dtd containing the references for HTML-entities and a sort of flag wheter the report column should be escaped or not, from within Apex. This would allow us to embed XML-fragments within the XML that Apex produces, resulting in a valid XML doc. Using XSL, you can then match the tags of the XML-fragment and convert it to FO.
    Good luck !
    Maarten

  • XML Publisher to generate Excel reports

    Can we use RTF template to generate Excel reports? Is all the process the same or do I need to do some additional set ups? Also, can I create a custom report , set the output format to xml and run XML Publisher on the top of it to generate output of my choice? HAs anybody tried this? or is it possible only in standard reports?
    Pl help. This is v urgent , i need to design my process flow accordingly
    Thanks much

    Hi
    Yes you can generate Excel from an RTF template - there are some limitations. The Excel in this case is not binary Excel - its XHTML and the mime type is set so that Excel opens it.
    So, you can not embed formulae, macros, etc in the RTF template and get the Excel output to execute them.
    You second question is what Publisher is all about, give it XML data and a layout of your choice and then pick the output format you want.
    Tim

  • Conditional suppression using substitution variable in Hyperion financial r

    Hi all,
    Is there a way that I can suppress a column using substitution variable in hyperion financial reporting?
    For eg, i want to suppress the column if the value of the substitution variable curr_mnth = jun.
    Is there a way to do this? In conditional suprression dialog box, I dont find this option.
    Please suggest.
    Your response is appreciated.
    Thanks,
    Sirisha.

    Hi Sirisha
    In my earlier reply I think I may have mislead you as I thought that you could set the member name equal to that in a row/column and I've managed to get into a HFR studio session this morning and realised that the conditional suppression only allows you to suppress where member name = 'XXX' (specific text) so that doesn;t meet your requirement.
    Different people will have different ways of achieving what you want and everyones requirements are different. If it helps my preferred way of conditionally suppressing periodic data (for Planning/Essbase) is to add a dynamic calc account member called 'TP-Index' into the database, set up a formula so that each period returns a numeric value from 1 to 12 to match the fiscal/calendar year as required.
    Then in reporting bring the account and period dimensions into rows/columns so that you are able to retrieve data for the TP-Index account and the period as defined in your substitution variable. You can then choose how the suppression works based on a numeric value, commonly you may want to suppress if greater than, e.g. you have a multi-period report where your actual data is to June so you want to suppress everything from July onwards.
    I'm sure that a similar thing could be achieved in HFM as well if that is your underlying system instead of Essbase.
    Does that help?
    Stuart

  • Using a function to create a report

    Hi,
    I have a report created with a select statement, I would like to create a function which will return the result of the select statement and use this function to create the report ?
    Does anybody know how I can do it ? I mean how to create a function returning a select statement, something like :
    function return_table(){ return (select * from emp;)}
    And how to use this function to generate a report ?
    Benn

    There is an application report that give you a listing of your region source and allows you to search the source and gives you links to edit it.
    Application Reports>Page Components>Search Region Source
    So you shouldn't have to keep it in a separate file.

  • Create New Variable for COPA Drilldown Reports in KE3E

    Hi,
    How can we create a formula variable for COPA Drill down reports in KE3E? In standard global variables formula variable is not avaiable, I need to create a formula variables like ...from period, to period, last fiscal year and next fiscal year..
    While creating report in KE31/KE35 trying create local variables, but it doesn't.
    Can any body advise how can we create a new variables for  "from period, to period, last fiscal year and next fiscal year.."
    Thanks
    VS Rao

    Hi Rao
    For Period (From &To)
    1. KE3E
    2. Type of Var = Char Value
        Enter variable name, say, ZPERIOD
        Field Name = PERDE
        Replacement type = Entry
        Enter Description
        Parameter/selectop = Selection Option
    For Fiscal Year
        Type of Var = Char Value
        Enter variable name, say, ZGJAHR
        Field Name = GJAHR
        Replacement type = Entry
        Enter Description
        Parameter/selectop = Parameter
    For Next and Last Fiscal Year
    When you define your form in KE34/KE35
    Use the variable ZGJAHR in your report
    In the column for Next Year, Enter "ZGJAHR+1" as the local variable for GJAHR
    In the Column for Last year, Enter  "ZGJAHR-1" as the local variable for GJAHR
    Regards
    Ajay M

  • Variables in WebI - several reports

    Hi,
    I'm reporting on SAP BW data in Web Intelligence. However, I'm not sure how to handle variables (prompts) in my scenario.
    I like the functionality that a WebI document can consist of several reports in different tabs. But how does this impact the use of variables (prompts)?
    One report should show sales data for a time period that is specified by the user. This can be handled via a bw variabe. Furthermore the next report should have a column with sales data for one month + one column for the accumulated data for the entire year up to that month.
    How should I arrange my variables in order to facilitate this? Should I use BW variables or should they be created in WebI?
    Regards,
    Fredrik

    Fredrik
    One report do follow the same approach (BEx Variable-- BO Prompt)
    Second report: (one month)
    1. Filter the data as per date.
    or
    2. Create one more query and implement prompt at Query level , which gives only one month data.
    or
    3. Create one more variable in BEx & make it as Optional.
    Hope it helps you.
    I'm Back

Maybe you are looking for