Child reports and bind variables
I'm working on a user defined parent/child report. What I'm having an issue with is using a parents bind variable value in a child. To simpify my example:
The master query is:
select count(*), document
from download_audit
where activity_date > sysdate-:DAYS
group by document
which returns a count of downloads for each document in the last :DAYS days. I want the child report to then list the person that downloaded a selected document:
select document, user_id, activity_date from download_audit
where activity_date > sysdate - :DAYS
and document=:DOCUMENT
This does not work because the initial :DAYS bind isn't sent to the child.
If I add the :DAYS as a selected column to the master sql it works. e.g.
select count(*), document, :DAYS days
from download_audit
where activity_date > sysdate-:DAYS
group by document
My question is, do child bind variables all have to be selected columns in the master query or is there a way to have a "global" bind variable that gets carried from master to child?
I'm using SQL Developer 3.2.20.09 on OS X Lion
Edited by: RoboMan on Nov 16, 2012 11:23 AM
I agree whole heartedly :)
If you want to make things even more interesting, create some 3rd generation child reports and carry the bind variables throughout the multiple levels - here's an example
http://www.thatjeffsmith.com/archive/2012/09/grandparent-parent-child-reports-in-sql-developer/
Similar Messages
-
Lexical and bind variables in RUN_PRODUCT
Hi all,
I have the following RUN_PRODUCT but it gives me "bad bind variable:
DECLARE
pl_id ParamList;
BEGIN
pl_id := Create_Parameter_List('tmpdata');
Add_Parameter(pl_id,'CATEGORY',TEXT_PARAMETER,(:CATEGORY));
Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
Add_Parameter(pl_id, 'DESTYPE', TEXT_PARAMETER, 'Screen');
Run_Product(REPORTS, 'C:\Pled', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
Destroy_Parameter_List( pl_id );
END;
How can I define both lexical and bind variables in a RUN_PRODUCT. Please assist!Hello Nicky,
The correct way to call Reports from Forms in 6i using the RUN_PRODUCT built-in using bind parameters would be something like the code given below. This example assumes that you have a form module parameter and a report parameter called 'category'.
declare
pl_id paramlist;
begin
pl_id := create_parameter_list('tmpdata');
add_parameter(pl_id, 'category', text_parameter, :parameter.category);
add_parameter(pl_id, 'paramform', text_parameter, 'no');
add_parameter(pl_id, 'destype', text_parameter, 'screen');
run_product(reports, 'c:\test_report.rdf', synchronous, runtime, filesystem, pl_id, null);
destroy_parameter_list( pl_id );
end;
Thanks,
The Oracle Reports Team. -
PreparedStatement and bind variable
We are experiencing some werid performance break downs where database server looks healthy and our java applications are down to their knees.
I was wondering if someone could help me clarify the comparison between PreparedStatement and bind variable. When I execute a PreparedStatement in java through the JDBC thin driver, would the database consider it a dynamic SQL or is it a SQL using bind variable? If this same statement is executed 100000 times, is it parsed 100000 times? We are using JDK131. How does it work?
Is there any memory leak in PreparedStatement implementation in JDBC thin driver? Is there any known symptom to this problem? What is the recommended solution?
Thank you very much!If PreparedStatement is parsed and cached, why is there setting to set implicit statement caching and explicit statement caching? Our DBA insists that it is parsed every single time. How would I find out for sure?
The SQLs have not been changed. This sudden performance degradation started when a new client went live and we experienced higher than usual volumn. We are connecting using JDBC thin client from weblogic server to Oracle 8.1.7. It's been happening everyday since the client went live and the only way to get the performance back is to shutdown and restart the database server.
I tried to search JDBC related issues. The only complain that I've found so far is that there may be some potential memory leak for a PreparedStatement. However, I have not found anything from Oracle's website that concurs to that.
What is my best bet? -
Report queries and bind variables - only header printing to PDF
Hi,
I created a simple report query for printing to PDF with 2 bind variables. I created a link to this report like this
Print - the header information prints but none of the data.
What am i doing wrong? I'm pretty sure it has s/t to do with the bind variables.
IF a/o can please help, i'd really appreciate it.
Thanks,
Hindyis it possible to export your application page to apex server and you shall also create a userid as demo/demo and post the url so that we shall try the debug
-
Query and bind variable display in reports
I have created a reports portlet using the locally built providers facility with the create a new reports. It seems to work fine except that the sql query and the bind variables show up in the report along with the report itself. How do I keep these from showing up?? I am on Portal 9.04
Ken RubeshON the Page displayoptions tab, you can select "Show Query Conditions?..
is that unselected?
if you are talking about the fields from your select statement showing up in the body of the report, you can set the field type to hidden on the 2nd tab(column formatting).
hope this helps -
Hey Everyone,
I'm having a bit of trouble creating a report. I need the FROM part of the code to use bind variables. I have come up with this peice of code below but im getting the following error:
failed to parse SQL query:
ORA-06550: line 1, column 8:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin function package pragma procedure subtype type use
form
current cursor
The symbol "" was ignored.
ORA-06550: line 2, column 24:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin function package pragma procedure subtype type use
form
current
Can anyone see where im going wrong?
Thanks in advance,
-N.S.N.O.
Code*
DECLARE
x VARCHAR2 (4000);
BEGIN
x := x || 'select *';
x := x || 'from ';
x := x || :p13_schema;
x := x || '.ddl_log@';
x := x || :p13_db_name;
x := x || '_DBAAPEX.TNTEWW.COM';
RETURN (x);
END;Hey Roel and Daylocks,
After getting frustrated for a while i deleted the page and started again. I put in the exact same code and it worked just how i wanted in the first place :S
The only thing i did different is when i was creating the report region the first time around i used a normal SQL query, For Example:
select sysdate from dual;
Then i modified it to
DECLARE
x VARCHAR2 (4000);
BEGIN
x := x || 'select ';*
x := x || 'from ';
x := x || :p14_schema;
x := x || '.ddl_log@';
x := x || :p14_db_name;
x := x || '_DBAAPEX.TNTEWW.COM';
RETURN (x);
END;
Whereas on the second attempt i used the peice of code in question straight away. Its been a bit of a frustrating morning because i used a similar peice of code for a different application, nevermind tho :)
Thanks for your replys, much appreciated.
-N.S.N.O. -
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,
~ronenAt 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 -
User Report data bind variable problems
Hello,
I am trying to build a simple report in SQLDeveloper, using a DATE bind variable. But it fails with the error message:
Inconsistent datatype, expected DATE got NUMBER
SELECT * FROM FLOW_COMP_REC_SUMMARY_RU
where create_date = trunc(:TARGET_DATE)
and type = 'D'
ORDER BY MESSAGE_FLOW_ID
Running this query in SQLDeveloper worksheet executes properly after a dialog box pops up and I enter: current_date - 1
SELECT * FROM FLOW_COMP_REC_SUMMARY_RU
where create_date = trunc(&TARGET_DATE)
and type = 'D'
ORDER BY MESSAGE_FLOW_ID
I've searched but no clear solutions present themselves. If you have one it would be most appreciated.
ThanksYou'll have to convert the input to date yourself:
SELECT * FROM FLOW_COMP_REC_SUMMARY_RU
where create_date = TO_DATE(:TARGET_DATE, 'DD/MM/YYYY')
and type = 'D'
ORDER BY MESSAGE_FLOW_ID
Have fun,
K. -
Why CBO don't use function-base index when I use like and bind variable
Hello
I have litle problem with function-base index and like with bind variable.
When I use like with bind variable, the CBO don't use my function-base index.
For example when I create table and index:
ALTER SESSION SET NLS_SORT='BINARY_CI';
ALTER SESSION SET NLS_COMP='LINGUISTIC';
alter session set nls_language='ENGLISH';
-- DROP TABLE TEST1;
CREATE TABLE TEST1 (K1 VARCHAR2(32));
create index test1_idx on test1(nlssort(K1,'nls_sort=BINARY_CI'));
INSERT INTO TEST1
SELECT OBJECT_NAME FROM ALL_OBJECTS;
COMMIT;
When I run:
ALTER SESSION SET NLS_SORT='BINARY_CI';
ALTER SESSION SET NLS_COMP='LINGUISTIC';
SELECT * FROM TEST1 WHERE K1 = 'abcd';
or
SELECT * FROM TEST1 WHERE K1 LIKE 'abcd%';
CBO use index.
PLAN_TABLE_OUTPUT
SQL_ID 4vrmp7cshbvqy, child number 1
SELECT * FROM TEST1 WHERE K1 LIKE 'abcd%'
Plan hash value: 1885706448
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 1 (100)| |
| 1 | TABLE ACCESS BY INDEX ROWID| TEST1 | 2 | 98 | 1 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | TEST1_IDX | 2 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("TEST1"."SYS_NC00002$">=HEXTORAW('6162636400') AND
"TEST1"."SYS_NC00002$"<HEXTORAW('6162636500') )
but when I run
SELECT * FROM TEST1 WHERE K1 LIKE :1;
CBO don't use index
PLAN_TABLE_OUTPUT
SQL_ID 9t461s1669gru, child number 0
SELECT * FROM TEST1 WHERE K1 LIKE :1
Plan hash value: 4122059633
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 89 (100)| |
|* 1 | TABLE ACCESS FULL| TEST1 | 2 | 48 | 89 (3)| 00:00:02 |
Predicate Information (identified by operation id):
1 - filter("K1" LIKE :1)
What should I change to force CBO to use index.
I don't wont use index hint in query.
My oracle version:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - ProductionOK. But why if I create normal index (create index test1_idx on test1(K1)) and return to default nls settings this same query use index.
PLAN_TABLE_OUTPUT
SQL_ID 9t461s1669gru, child number 0
SELECT * FROM TEST1 WHERE K1 LIKE :1
Plan hash value: 598212486
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 1 (100)| |
|* 1 | INDEX RANGE SCAN| TEST1_IDX | 1 | 18 | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - access("K1" LIKE :1)
filter("K1" LIKE :1)
Note
- dynamic sampling used for this statement (level=2)
when index is function-base (create index test1_idx on test1(nlssort(K1,'nls_sort=BINARY_CI')))
PLAN_TABLE_OUTPUT
SQL_ID 9t461s1669gru, child number 1
SELECT * FROM TEST1 WHERE K1 LIKE :1
Plan hash value: 4122059633
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 89 (100)| |
|* 1 | TABLE ACCESS FULL| TEST1 | 3 | 54 | 89 (3)| 00:00:02 |
Predicate Information (identified by operation id):
1 - filter("K1" LIKE :1)
Note
- dynamic sampling used for this statement (level=2)
when I create index with upper function "index test1_idx on test1(upper(K1))" the query use index
SELECT * FROM TEST1 WHERE upper(K1) LIKE :1
Plan hash value: 1885706448
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | | | 1 (100)| |
| 1 | TABLE ACCESS BY INDEX ROWID| TEST1 | 4481 | 157K| 1 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | TEST1_IDX | 806 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("TEST1"."SYS_NC00002$" LIKE :1)
filter("TEST1"."SYS_NC00002$" LIKE :1)
Note
- dynamic sampling used for this statement (level=2) -
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 PMHi,
try the BI Publisher forum for question towards this product BI Publisher
Frank -
Dynamic sql and bind variables
Hi,
I have a stored procedure which filters a table on 5 five columns. The filters come from the input parameters,
and these 5 parameters can come in any combination, I mean some of them may be null and some of them may not be null.
So I constructed the where filter of the query with IF blocks like the following:
dynamic_query := 'select * from TESTTABLE where 1= 1';
IF (P1 is not null) THEN
dynamic_query := dynamic_query || ' AND column1 = :1';
END IF;
IF (P2 is not null) THEN
dynamic_query := dynamic_query || ' AND column2 = :2';
END IF;
IF (P3 is not null) THEN
dynamic_query := dynamic_query || ' AND column3 = :3';
END IF;
IF (P4 is not null) THEN
dynamic_query := dynamic_query || ' AND column4 = :4';
END IF;
IF (P5 is not null) THEN
dynamic_query := dynamic_query || ' AND column5 = :5';
END IF;
OPEN CUR_OUT FOR dynamic_query USING P1, P2, P3, P4, P5;
The problem is how can I construct the USING and bind parameters, I cannot use "USING P1, P2, P3, P4, P5" because some of bind variables
may not be in dynamic query if the input parameters are null. Is there a way to overcome this problem without writing all the 2 ^ 5 combinations?
Any help is greatly appreciated.here it is in the Tomer Cohen way:
IF (P1 is not null) THEN
dynamic_query := dynamic_query || ' AND column1 = :1';
ELSE
dynamic_query := dynamic_query || ' AND :1 IS NULL';
END IF;
IF (P2 is not null) THEN
dynamic_query := dynamic_query || ' AND column2 = :2';
ELSE
dynamic_query := dynamic_query || ' AND :2 IS NULL';
END IF;
IF (P3 is not null) THEN
dynamic_query := dynamic_query || ' AND column3 = :3';
ELSE
dynamic_query := dynamic_query || ' AND :3 IS NULL';
END IF;
IF (P4 is not null) THEN
dynamic_query := dynamic_query || ' AND column4 = :4';
ELSE
dynamic_query := dynamic_query || ' AND :4 IS NULL';
END IF;
IF (P5 is not null) THEN
dynamic_query := dynamic_query || ' AND column5 = :5';
ELSE
dynamic_query := dynamic_query || ' AND -1 = :5';
END IF;
OPEN CUR_OUT FOR dynamic_query USING P1, P2, P3, P4, P5;Amiel Davis -
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,
JoergI 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. -
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 -
ManagedBean and Bind Variables in ADF applications
Situation with Target Unreachable, 'TestBean'.
ManagedBean: TestBean, parameter objectId
ViewObject: sql-based: select * from someobject where id = :objectId
Unbounded taskflow with the one page: Start.jspx
Bounded TaskFlow "TestTaskFlow" with pagefragments: ButtonView.jsff and ObjectCard.jspx (as dialog).
On the ButtonView there is a button with: action="dialog:OBJECT", actionListener.
ActionListener handler I create by using the JDev Wizard. And the record was appeared in the adfc-config.xml. Is it correct? since the button is in the Taskflow. So in the taskflow there is no records about managed beans. May be it is Ok.
Than, on the ObjectCard.jspx add ExecuteWithParams VO method, and set bind variable from the managedbean attribute. and get an error:
SEVERE: Server Exception during PPR, #1
javax.servlet.ServletException: Target Unreachable, 'TestBean' returned null
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: javax.faces.el.EvaluationException: Target Unreachable, 'TestBean' returned null
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1227)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:142)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:754)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:282)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
... 27 more
Than I add this managedbean in the Taskflow too. There is no exception, but bind variables has not been set.Hi,
most likely the managed bean got created in the adfc-config.xml file. If then it has a scope of pageFlowsScope, then it cannot be found. Move the managed bean or use it with a scope of requestScope or backingBeanScope
Frank -
V$Sqlarea, Audit, and Bind Variables
I have enabled auditing to track down a problem. With the info in SYS.AUD$ tied to V$SESSION and V$SQLAREA I can see the actual statement that the user executed. The problem that I have is that everything is in bind variables.
Does anybody know how to find the values within the bind variables for a session in $SQL_AREA?
Thanks in advance,
Chris S.Which version of the database are you using? Have you considered using Oracle9i's Fine Grained Audit functionality.
Cheers, APC
Maybe you are looking for
-
Filling the entire screen in Photoshop Elements 10
I don't know how to fill my screen with the image as I can in regular Photoshop.There's all these editing tools taking up much of the screen.Any help would be appreciated.
-
IBooks Author, one book multiple languages!
Hey, I am writing a book in iBooks author that will eventually be published in the US, Europe and Canada. It is a technical publication and while the content is identical regardless of where you are reading the book I want to be able to publish diffe
-
Running Oracle Reports in unix, output in pdf file
Hi all, Anybody currently running Oracle Reports in unix platform and the output is generated in pdf format & display in browser? Can you please advise on what are all the environment variables that I have to set in order to get the report runs? Besi
-
When selecting RDS in the Radio settings on my 6500 Slide, a 'dialog box' Proram Error is displayed. The radio acts as a normal FM radio. My SW version is V 04.81 Any with same problem og a solution?
-
How long should an Ipad3 be charged?