User defined report with bind variable

How can I create an user defined report using a bind variable?

We currently do not support bind variables in User Defined Reports. We are looking at adding that function before production but I can't promise.
-- Sharon

Similar Messages

  • 2.1.1 Problem with User Defined Reports with actions on the context menu

    I use the User Defined Reports quite a lot, and export and publish these to other members of the team as Shared Reports. I'm also quite disappointed that there seems to be no further development in this area of SQL Developer.
    One of the totally undocumented features of User Defined Reports is the ability to attach actions to a context menu, and pass data from the grid to a procedure, for example. Copying, then exporting the sessions report (from All Reports -> Data Dictionary Reports -> Database Administration -> Sessions) exposes the XML for adding actions to the context menu. The snippet for killing a session looks like this:
    <item  reload="true"  reloadparent="false" removeFromParent="false">
      <title>Kill Session</title>
      <prompt type="confirm" >     
        <label>Kill Session?</label>     
        <default><![CDATA[]]></default>     
        <value><![CDATA[]]></value>        
      </prompt>
      <sql><![CDATA[ALTER SYSTEM KILL SESSION '#SID#, #SERIAL#' IMMEDIATE]]></sql>
      <help>Kill the selected session.</help>
    </item>So to add this type of functionality to your own user defined reports, you need to export the report, edit the XML, and import it again. It seems to work fine to add this to the master reports, but if you add an <item> element to the child reports, the context menu items appear on the master report too, and they are duplicated many times. I'm not sure if the action of exporting the report adds to the number of times the context menu appears.
    Warning - if you edit a report using SQL Developer, all the <item> tags are removed. Once you've added actions to a context menu, you can only edit the report by exporting it, modifying the XML and importing it again.
    Has anyone else seen this behavior? Have you found a work-around?
    To the SQL Developer team: Are there any plans to allow the adding of user defined context menu items to reports using the GUI in the near future?

    You're right the context menu needs a GUI desperately. You can request this at the SQL Developer Exchange, so other users can vote and add weight for possible future implementation.
    Regards,
    K.

  • Report with bind variables

    Hi,
    I apologize in advance for the newbie question.
    I would like to create a report report_b with a "vertical report exclude null values" template which will show only one record. This report will be called from another report with a default template or perhaps an interactive report - report_a.
    The order of actions is:
    A user logs in queries report_a and gets a result of a few rows.
    She presses the link column of a specific record with id 123 in the report and report_b is called displaying the relevant information of id 123.
    I haven't been able to figure out how to use bind variables to achieve this.
    The use case is: I have a table with dozens of columns. Both reports are based on the same table but report_a only displays 3-4 columns to allow the user to figure out which row he wants to see and then she gets to see all its columns in report_b.
    Many thanks,
    ~ronen

    At a very high level, this is what needs to happen:
    Let us say report_a is on Page 10 (P10), and report_b is on P11.
    When the user clicks a link on a column in report_a on P10, this should a hidden item on P11 (say P11_ID).
    When P11 is displayed, the SQL would use the value stored in P11_ID. For example, Select col1, col2, col3 from table_a where id = :P11_ID.
    If you need more and specific example, please let us know.
    Ravi

  • How to use p_mainsearch parameter in basic search for a report with bind variable?

    Hello,
    I'd like to extend the basic-search in content-area elements to extra records in my own tables.
    So I'd like to use the p_mainsearch-urlparameter (which holds the searchtext of a basic search) into a bind variable of my own report. My report will be on an extra tab on the search-page.
    Especially I don't know how to transfer the value of p_mainsearch into the bind variable of the report.
    Has anyone done that so far?
    Example?
    Thank you,
    Joerg

    I found out the following way:
    1.)Report
    1.1)SQL-Query:
    select * from <owner>.<tablename> where UPPER(column) like '%'||UPPER(NVL(:searchtext,'abczyx123098'))||'%'
    (Note: bind variable is :searchtext).
    1.2)in "before displaying page"-section in "additional plsql" add the following:
    if length(get_value('p_mainsearch')) >= 3 then
    portal30.wwv_name_value.replace_value(
    l_arg_names, l_arg_values, p_reference_path||'.searchtext,
    portal30.wwv_standard_util.string_to_table2(get_value('p_mainsearch')));
    end if;
    1.3) publish as portlet
    2.) Integrate the report-portlet into a new tab on search page. Run basic search.
    Change to the tab with the portlet.
    For me it is solved.
    Joerg.

  • OBIEE Integration with ADF - Reports with bind variables

    Hi,
    I've managed to integrate obiee with ADF by following the steps described in:
    http://www.oracle.com/technetwork/middleware/bi-publisher/adf-bip-ucm-integration-179699.pdf
    This is all fine and all but what about reports with complex queries where bind variables are needed?
    In short I need to send specific values from ADF application as parameters to the query of the report before building it, then create it and download the file as pdf.
    I don't have problems with building the file and downloading it when the query in the report has no bind variables, but when it does I do not know how to send them to the report.
    I can't seem to find such an implementation or example anywhere and I am stuck.
    Could anyone please point me in the right direction, eighter by providing a solution, or a link to such an example?
    Thank you!
    P.S.
    I'm using OBIEE 11.1.1.6.0 and JDeveloper 11.1.2.1.0
    Mihai Cornean
    Edited by: 885382 on Apr 11, 2013 11:10 PM

    Hi,
    try the BI Publisher forum for question towards this product BI Publisher
    Frank

  • Problem in User defined reports

    Hi!!
    I'm trying to generate an user defined report using following querry
    select
    Decode(:x,1,'ONE',
    2,'TWO',
    3,'Three',
    4,'Four',
    5,'Five',
    6,'Six',
    7,'Seven',
    8,'Eight',
    9,'Nine')
    from Dual;
    But its not working. I'm getting an error message stating
    "Mising IN or OUT parameter at Index:1"
    Vendor code 17041
    plz help

    I don't think user defined reports supports bind variables yet.

  • Bind variables in User Defined Reports

    SQL Developer 1.0.0.11 / Windows XP / Oracle 9.2.0.5
    Thanks for adding the capability for bind variables in user defined reports. However, if there is more than one instance of the same bind variable in the report, the "Enter Bind Values" prompt lists all instances and requires the value be input for all instances. This is unlike the SQL worksheet which only lists the bind variable once. Please change the report behavior to prompt only once per unique bind variable.

    Just spoke with the developer of this - you will be prompted for each instance of a bind. That will not change any time soon so I wanted to let you know -
    -- Sharon

  • 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

  • Having trouble with variables followed by a period in user defined reports.

    Using SQL Developer 1.0.0.15 on XP.
    The DB is Oracle 10.
    Having trouble with variables followed by a period in user defined reports.
    select * from &OWNER.TABLE_NAME
    I noticed that the "Data Dictionary Reports" use :OWNER
    So I have tried all sort of variations:
    select * from :OWNER.TABLE_NAME
    select * from :OWNER\.TABLE_NAME
    select * from ":OWNER".TABLE_NAME
    select * from ':OWNER'.TABLE_NAME
    select * from (:OWNER).TABLE_NAME
    And every other variation I can think of. This is a simple example, but all my reports need the owner of tables as a variable.
    I assume this is simple, I just have not hit the right combination.
    Thanks -
    Dyer

    Use two points ..
    select * from &OWNER..TABLE_NAME

  • SLOW report performance with bind variable

    Environment: 11.1.0.7.2, Apex 4.01.
    I've got a simplified report page where the report runs slowly compared to running the same query in sqldeveloper. The report region is based on a pl/sql function returning a query. If I use a bind variable in the query inside apex it takes 13 seconds to run, and if I hard code a string it takes only a few hundredths of a second. The query returns one row from a table which has 1.6 million rows. Statistics are up-to-date and the columns in the joins and where clause are indexed.
    I've run traces using p_trace=YES from Apex for both the bind variable and hard coded strings. They are below.
    The sqldeveloper explain plan is identical to the bind variable plan from the trace, yet the query runs in 0.0x seconds in sqldeveloper.
    What is it about bind variable syntax in Apex that is causing the bad execution plan? Apex Bug? 11g bug? Ideas?
    tkprof output from Apex trace with bind variable is below...
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM(:P71_SEARCH_SOURCE1)))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.01          0          1         27           0
    Fetch        2     13.15      13.22      67694      72865          0           1
    total        4     13.15      13.23      67694      72866         27           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=72869 pr=67694 pw=0 time=0 us cost=29615 size=14255040 card=178188)
          1   FILTER  (cr=72869 pr=67694 pw=0 time=0 us)
          1    HASH JOIN RIGHT SEMI (cr=72865 pr=67694 pw=0 time=0 us cost=26308 size=14255040 card=178188)
          1     INDEX FAST FULL SCAN IDX$$_0A300001 (cr=18545 pr=13379 pw=0 time=0 us cost=4993 size=2937776 card=183611)(object id 68485)
    1696485     TABLE ACCESS FULL PERSONS (cr=54320 pr=54315 pw=0 time=21965 us cost=14958 size=108575040 card=1696485)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     HASH JOIN (RIGHT SEMI)
          1      INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                     'IDX$$_0A300001' (INDEX)
    1696485      TABLE ACCESS   MODE: ANALYZED (FULL) OF 'PERSONS' (TABLE)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file scattered read                       1276        0.00          0.16
      db file sequential read                       812        0.00          0.02
      direct path read                             1552        0.00          0.61
    ********************************************************************************Here's the tkprof output with a hard coded string:
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM('0b')))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.02       0.04          0          0          0           0
    Execute      1      0.00       0.00          0          0         13           0
    Fetch        2      0.00       0.00          0          8          0           1
    total        4      0.02       0.04          0          8         13           1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=10 pr=0 pw=0 time=0 us cost=9 size=80 card=1)
          1   FILTER  (cr=10 pr=0 pw=0 time=0 us)
          1    NESTED LOOPS  (cr=8 pr=0 pw=0 time=0 us)
          1     NESTED LOOPS  (cr=7 pr=0 pw=0 time=0 us cost=8 size=80 card=1)
          1      SORT UNIQUE (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1       TABLE ACCESS BY INDEX ROWID PERSON_SYSTEMS (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1        INDEX RANGE SCAN IDX_PERSON_SYSTEMS_SOURCE_KEY (cr=3 pr=0 pw=0 time=0 us cost=3 size=0 card=1)(object id 68561)
          1      INDEX UNIQUE SCAN PK_PERSONS (cr=3 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 68506)
          1     TABLE ACCESS BY INDEX ROWID PERSONS (cr=1 pr=0 pw=0 time=0 us cost=2 size=64 card=1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     NESTED LOOPS
          1      NESTED LOOPS
          1       SORT (UNIQUE)
          1        TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                       'PERSON_SYSTEMS' (TABLE)
          1         INDEX   MODE: ANALYZED (RANGE SCAN) OF
                        'IDX_PERSON_SYSTEMS_SOURCE_KEY' (INDEX)
          1       INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'PK_PERSONS'
                      (INDEX (UNIQUE))
          1      TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                     'PERSONS' (TABLE)

    Patrick, interesting insight. Thank you.
    The optimizer must be peeking at my bind variables with it's eyes closed. I'm the only one testing and I've never passed %anything as a bind value. :)
    Here's what I've learned since my last post:
    I don't think that sqldeveloper is actually using the explain plan it says it is. When I run explain plan in sqldeveloper (with a bind variable) it shows me the exact same plan as Apex with a bind variable. However, when I run autotrace in sqldeveloper, it takes a path that matches the hard coded values, and returns results in half a second. That autotrace run is consistent with actually running the query outside of autotrace. So, I think either sqldeveloper isn't really using bind variables, OR it is using them in some other way that Apex does not, or maybe optimizer peeking works in sqldeveloper?
    Using optimizer hints to tweak the plan helps. I've tried both /*+ FIRST_ROWS */ and /*+ index(ps pk_persons) */ and both drop the query to about a second. However, I'm loath to use hints because of the very dynamic nature of the query (and Tom Kyte doesn't like them either). The hints may end up hurting other variations on the query.
    I also tested the query by wrapping it in a select count(1) from ([long query]) and testing the performance in sqldeveloper and in Apex. The performance in that case is identical with both bind variables and hard coded variables for both Apex and SqlDeveloper. That to me was very interesting and I went so far as to set up two bind variable report regions on the same page. One region wrapped the long query with select count(1) from (...) and the other didn't. The wrapped query ran in 0.01 seconds, the unwrapped took 15ish seconds with no other optimizations. Very strange.
    To get performance up to acceptable levels I have changed my function returning query to:
    1) Set the equality operator to "=" for values without wildcards and "like" for user input with wildcards. This makes a HUGE difference IF no wildcard is used.
    2) Insert a /*+ FIRST_ROWS */ hint when users chose the column that requires the sub-query. This obviously changes the optimizer's plan and improves query speed from 15 seconds to 1.5 seconds even with wildcards.
    I will NOT be hard coding any user supplied values in the query string. As you can probably tell by the query, this is an application where sql injection would be very bad.
    Jeff, regarding your question about "like '%' || :P71_SEARCH_SOURCE1 || '%'". I've found that putting wildcards around values, particularly at the beginning will negate any indexing on the column in question and slows performance even more.
    I'm still left wondering if there isn't something in Apex that is breaking the optimizer "peeking" that Patrick describes. Perhaps something in the way it switches contexts from apex_public_user to the workspace schema?

  • Report Performance with Bind Variable

    Getting some very odd behaviour with a report in APEX v 3.2.1.00.10
    I have a complex query that takes 5 seconds to return via TOAD, but takes from 5 to 10 minutes in an APEX report.
    I've narrowed it down to one particular bind. If I hard code the date in it returns in 6 seconds, but if I let the date be passed in from a parameter it takes 5+ minutes again.
    Relevant part of the query (an inline view) is:
    ,(select rglr_lect lect
    ,sum(tpm) mtr_tpm
    ,sum(enrols) mtr_enrols
    from ops_dash_meetings_report
    where meet_ev_date between to_date(:P35_END_DATE,'DD/MM/YYYY') - 363 and to_date(:P35_END_DATE,'DD/MM/YYYY')
    group by rglr_lect) RPV
    I've tried replacing the "to_date(:P35_END_DATE,'DD/MM/YYYY') - 363" with another item which is populated with the date required (and verified by checking session state). If I replace the :P35_END_DATE with an actual date the performance is fine again.
    The weird thing is that a trace file shows me exactly the same Explain Plan as the TOAD Explain where it runs in 5 seconds.
    Another odd thing is that another page in my application has the same inline view and doesn't hit the performance problem.
    The trace file did show some control characters (circumflex M) after each line of this report's query where these weren't anywhere else on the trace queries. I wondered if there was some sort of corruption in the source?
    No problems due to pagination as the result set is only 31 records and all being displayed.
    Really stumped here. Any advice or pointers would be most welcome.
    Jon.

    Don't worry about the Time column, the cost and cardinality are more important to see whther the CBO is making different decisions for whatever reason.
    Remember that the explain plan shows the expected execution plan and a trace shows the actual execution plan. So what you want to do is compare the query with bind variables from an APEX page trace to a trace from TOAD (or sqlplus or whatever). You can do this outside APEX like this...
    ALTER SESSION SET EVENTS '10046 trace name context forever, level 1';Enter and run your SQL statement...;
    ALTER SESSION SET sql_trace=FALSE;This will create a a trace file in the directory returned by...
    SELECT value FROM v$parameter WHERE name = 'user_dump_dest' Which you can use tkprof to format.
    I am assuming that your not going over DB links or anything else slightly unusual?
    Cheers
    Ben

  • [eval 1.1.0.21]sort in user-defined ended with ; report produces ORA-00911

    reproduce it with :
    1) user defined reports --> add report --> SQL :
    select * from scott.emp;2) click on the sort icon in the header of the column
    the workaround is to not include the ; in the sql
    regards
    Laurent
    Message was edited by:
    Laurent Schneider
    prefixed!

    Laurent,
    Please can you prefix your comments with Eval 1.1.0.21.4.1? We'll be doing regular eval releases for the next few weeks and many of the folk on the forum are still on 1.0 (15.57), so we need to try to keep queries clear.
    I know what you are testing and using, but others migt not.
    As for the comment: Yes, thanks - no need for ';' on any user defined reports. You'll see if you copy the shipped reports they don't have it either. Useful to note.
    Sue

  • All sqls executed by an user with a timeframe with bind variables.

    10.2.0.4 Version.
    Is there a way to get list of all the sqls executed by an user between time t1 and t2 with bind variables along with the stats from v$sql.
    I am able to get binds from v$sql_bind_capture for an user but not able to restrict to the time frame I want.
    Thanks for help in advance.

    Enable 10046 trace (level=12) for the sessions in question.
    Make sure you have enough free space available as this could result in a huge file depending on session's activity.
    Asif Momen
    http://momendba.blogspot.com

  • Update before a report shows with bind variable

    I need to update a table before a report shows. This report have bind variable and I need bind variable value for clause where in update, how can I do that?
    I would thank so much any idea

    Mery,
    If I understand correctly your application should display a report when it is called.
    But first, before the report is displayed, you want to update a table, using a bind variable passed into the report when it is called. Do I understand correctly so far?
    So while editing the report, in the last tab option you have (Additional PL/SQL Code), you need to put some pl/sql code into section titled '...before displaying the page.'
    declare
    begin
    update table_x
    set column_x = somevalue
    where column_y = bind_variable;
    end;
    I haven't yet passed bind variables into reports so I'm not quite sure how to retrieve them, but I'm sure there are other postings here about that.
    I'm mostly just trying to clarify if this is what your asking, and maybe somebody else can answer the rest of your questions.
    Good luck.
    Kurt

  • Detail view with bind variable. TreeTable not showing all detail result.

    I’m having trouble with treeTable using detail view with bind variables and where clause defined in VO definition.
    Both, master and detail view objects, base on the same entity and have the same condition in where clause. The view objects also have bind variables, which are set in prepareRowSetForQuery() method.
    Again, these are two different views, that get different result, based on value of one of the bind variable.
    When I show results in two different tables on jsf page, where master table has "RowSelection" set on "single", all results are displayed in detail table.
    But when I use treeTable, only the first result of the detail is shown.

    I tested it in applicationModule and it works, but i think that's the same as two tables on a jsf page.
    This is the order in which overridden methods are called in ADF BC or two tables on jsf page
    when clicking on row in master table.
    PrepareRowSetForQueryDetail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;  -> print of the object2[] parameter in executeQueryForCollection
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035313 -> viewLink parameter value
    getEstimatedRowCount_Detail
    count: 2
    getEstimatedRowCount_Detail
    count: 2 And when i click on "expand node" in tree table:
    getEstimatedRowCount_Root
    count: 2
    PrepareRowSetForQuery_Detail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035321
    PrepareRowSetForQueryDetail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035313
    getEstimatedRowCount_Root
    count: 2
    getEstimatedRowCount_Root
    count: 2
    getEstimatedRowCount_Root
    count: 2
    PrepareRowSetForQueryDetail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035313
    PrepareRowSetForQueryDetail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035321
    getEstimatedRowCount_Root
    count: 2
    getEstimatedRowCount_Root
    count: 2Values of user parameters are OK. Is there another method that i should override?
    I also noticed, that if detail view doesn't have user bind variables, the tree works fine and is shown even in ADF BC (aplication module).
    I guess we loose a tree, when using bind variables in detail view object.
    Is there a way around it?

Maybe you are looking for