Get variable bind
I've created a report of a SQL query. It has a variable binding in the query. I use the personalization with a LOV page to define the variable binding. It all works very well. Now, I want to display the value of the display_column when the report is run. Showing the conditions of query displays the numerical value of return, which won't make much sense to the user. How can I get the value of the binding variable so I can view it?Published by: user478864 on August 31, 2010 12:12
You will need to do all in PL/SQL, as follows:
DECLARE
v_param_value VARCHAR2(10);
v_display_value VARCHAR2(100);
BEGIN
v_param_value := get_value('p_your_parameter');
SELECT t.display_column INTO v_display_value FROM your_table t WHERE t.return_column = v_param_value;
htp.p(v_display_value);
END;
Tags: Fusion Middleware
Similar Questions
-
Get the bind variables name string SQL or the cursor
Hello
Is there way to get of the bind variables name string SQL or the cursor?
Example of
What I mean with the SQL string:DECLARE l_sql VARCHAR2(2000); desctab DBMS_SQL.DESC_TAB; curid PLS_INTEGER; BEGIN l_sql := 'SELECT * FROM emp WHERE mgr = :X and deptno = :Y'; curid := dbms_sql.open_cursor; dbms_sql.parse(curid, l_sql, dbms_sql.NATIVE); .... END;
I love to get using some functions from above code variable l_sql all the bind variable.
In this case the function should return array where is for example: X and: Y
Back to bind the cursor variable names, I mean same but rather string I pass number of cursor.
Y at - it sucks ready function or some may share a code customized for this purpose?
Thanks
Kind regards
Jari
http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0Regards,
Published by: jarola December 19, 2011 02:44
I found there are wwv_flow_utilities.get_binds of the function not documented in APEX packages that do what I want.
Usage example
But I would not use these functions without papers as those who can change or there is no future versions APEX.set serveroutput on DECLARE binds DBMS_SQL.varchar2_table; BEGIN binds := wwv_flow_utilities.get_binds('select :P1_TEST from dual'); FOR i IN 1 .. binds.count LOOP dbms_output.put_line(binds(i)); END LOOP; END; / anonymous block completed :P1_TEST
Is there a documented function or the custom function that do the same thing as wwv_flow_utilities.get_binds?Some old basic example code of my friends. Also the media getting the bind variable of PL/SQL code blocks anon.
SQL> create or replace function GetBindVariables( statement varchar2 ) return TStrings is 2 --// bind variables names are terminated by one the following special chars 3 SPECIAL_CHAR constant TStrings := TStrings(' ',')','+','-','>','<','*',',','=',';',CHR(10),CHR(13)); 4 5 --// max size of a bind var name 6 MAX_VARSIZE constant integer := 100; 7 8 pos integer; 9 pos1 integer; 10 occur integer; 11 varName varchar2(100); 12 varList TStrings; 13 begin 14 varList := new TStrings(); 15 16 --// looking for the 1st occurance of a bind variable 17 occur := 1; 18 19 loop 20 pos := InStr( statement, ':', 1, occur ); 21 exit when pos = 0; 22 23 varName := SubStr( statement, pos, 100 ); 24 25 --// find the terminating char trailing the 26 --// bind variable name 27 pos1 := Length( varName ); 28 for i in 1..SPECIAL_CHAR.Count 29 loop 30 pos := InStr( varName, SPECIAL_CHAR(i) ) - 1; 31 if (pos > 0) and (pos < pos1) then 32 pos1 := pos; 33 end if; 34 end loop; 35 36 --// extract the actual bind var name (without 37 --// colon char prefix) 38 varName := SubStr( varName, 2, pos1-1 ); 39 40 --// maintain a unique list of var names 41 if not varName member of varList then 42 varList.Extend(1); 43 varList( varList.Count ) := varName; 44 end if; 45 46 --// look for the next occurance 47 occur := occur + 1; 48 end loop; 49 50 return( varList ); 51 end; 52 / Function created. SQL> SQL> select 2 column_value as BIND_VAR 3 from TABLE( 4 GetBindVariables('select * from foo where col=:BIND1 and day = to_date(:B2,''yyyy/mm/dd'')') 5 ); BIND_VAR ------------------------------ BIND1 B2 SQL>
PS. just realize this code is case-sensitive, while variable bind is not. Should throw a upper() or lower() by adding the name of the var to the list - never really a problem for me because I'm pretty tense when it use cases correctly in the code. ;-)
Published by: Billy Verreynne, December 19, 2011 06:19
-
How many times can I use a variable binding in a query of the VO?
Is it possible that I can use a variable binding in a query of VO just once?
I test a query that keeps throwing the Houston-27122 error by pressing the application module tester. I tried to limit the problem to the simplest possible case, and it seems that the error is caused by the fact that I use the same variable bind two or more times.
When the query looks like this:
I have run, enter 'x' and it returns me the result.
When I change to:
I have run, enter the value
and immediately get the error
The same thing in sqlplus runs without problem:
My version of JDev is build JDEVADF_11.1.1.9.0_GENERIC_150314.0718.6673
Please, advise.
P. S. where can I find documentation queries are supported in your? In particular, I'm interested if I can use WITH the clause. There seems to be some confusion on this matter (see, for example, Oracle SQL WITH clause support - JDeveloper and ADF)
Thank you.
It depends on:
Open your VO in JDev and go the the query page.
In the lower part, there is a drop down 'link type', it is usually set to "JDBC-positional. In this case, you will need to provide the bind value for each occurrence of the variable binding separately.
You could change that to "named" (don't remember the exact name). But beware, this will also affect all relatioships master retail to others your. I think that this is not a good idea to change the style of binding to a single VO.
Good bye
DPT
-
The value of variable binding VO on page load by program
Hello everyone!
I use JDeveloper version 11.1.2.3.0
I am currently trying to get the filtered data to a VO, based on a WHERE clause with a variable binding. This process must be done on the loading of the page. I have set this variable for liaison with the id of the logged in user (the part to get this id is already reached and used somewhere else). My current approach is to define a bean managed with scope pageFlow. Inside of this, I have a method in which I get the id and I put it as parameter. The code snippet:
BindingContainer bindings = getBindings(); OperationBinding operationBinding = bindings.getOperationBinding("getUserIdFromUsername"); //getUserIdFromUsername is a method defined in the AppModule and exposed in the client interface operationBinding.getParamsMap().put("username", getUserName()); Object userID = operationBinding.execute(); setUserId(Integer.parseInt(userID.toString())); System.out.println("THE USER ID IS: "+getUserId()); BindingContainer bindings2 = getBindings(); OperationBinding operationBinding2 = bindings.getOperationBinding("ExecuteWithParams"); // i've dragged and dropped the ExecuteWithParams operation into the page operationBinding2.getParamsMap().put("userId", getUserId()); // userId is the bind variable which i'm talking about Object result = operationBinding2.execute();
Then I call this method on BeforePhase in the view of the page. It works, I get the filtered data and the println shows me the correct ID. The problem is that whenever I select a row in the table showing the data, the page seems to reload and it always reload the selection at the forefront.
What I am doing wrong? Maybe this isn't the right approach, that I saw a few other posts on this topic, but they are not very clear to me.
Please advice
OK, that's what I did. I created the method to set the value of the variable to bind to the query of the VO in the AppModule instead of inside the bean (this method also runs the query) and client presentation to the interface. After I have created the method call in the section of links the pagedef (where he gets the value of the id of the bean in the original post), and followed Cvele_new_account suggestion, calling the method as follows:
RefreshCondition = "#{! requestContext.postback and empty bindings.exceptionList}" / >
Thank you for the help guys! -
Setting value to a variable binding
Binds the values of variables can be access with this:
AttributeBinding deptBinding =
(AttributeBinding) getBindings () .getControlBinding (bindName);
Return deptBinding.getInputValue ();
Can I set the value of a variable binding in the same way?
To define a value of binding, I currently have access to the ViewObjectRowImpl and make a setVar (x) in order to get, but it's very hard. I would like a more direct via liaison system if possible.Yes you can set it as
AttributeBinding attr = (AttributeBinding) bindings.getControlBinding ("test");
attr.setInputValue ("test"); -
Display Variable binding object, query, (Bean.attribute) HOW?
Hi, I use an attribute of bean as a Bind Variable in a query to a display object.
I have the following bean:
In a fragment of web page, I have an af:table of the DB (by datacontrol). It is necessary that the table load only the lines with the idDocIPM in his ID_DISTRIBUTION column. I did this:package model; public class FalseBPM {//Simulate a BPM payload private String idDocIPM; public FalseBPM() { idDocIPM="5.IPM_016801"; } public String getIdDocIPM() { return idDocIPM; } public void setIdDocIPM(String idDocIPM) { this.idDocIPM = idDocIPM; } }
In my view, object-> query:
In my display-> query object: - > variable binding:SELECT IpmDistributionManual.ID_DISTRIBUTION, IpmDistribucionManual.ID_BUSINESS, IpmDistribucionManual.ID_CHANNEL, IpmDistribucionManual.ID_ENTITY, IpmDistribucionManual.VALUE FROM IPM_DISTRIBUTION_MANUAL IpmDistributionManual WHERE IpmDistributionManual.ID_DISTRIBUTION=:ID
How can I do this?<Variable Name="ID" Kind="where" Type="java.lang.String" DefaultValue="#{falseBPM.idDocIPM}"/> //But I get an error in Literal or in Expression mode.
Thanks in advance.
Published by: Sarah on 28/10/2011 07:41Sarah,
In your workflow, drag and drop the action 'run with the settings' for your view object (it is in the range of data control) on the workflow as a method call activity. Bind the parameter to the value of bean with EL (that you have tried to do in the VO itself - note that you can not use EL in the template like this project). Then, make sure the method call is wired to the top to run before your activity in the workflow view.
John
-
Use sessionScope as the value of the Variable binding
Dear all,
I have a variable in sessionScope, and I want to use it as a condition of application of a ViewObject.
I found a thread talking about, there's only one: ( )
How to use the value in the scope of session groovy script?
Model project:
Set variable in the scope of the session:
ADFContext.getCurrent () .getSessionScope () .put ("Empno", empno);
Getting value of session scope:
Object empno is ADFContext.getCurrent () .getSessionScope () .get ("Empno");.
ViewProject:
Set variable in the scope of the session:
FacesContext.getCurrentInstance () .getExternalContext () .getSessionMap () .put ("Empno", empno);
Getting value of session scope:
Object empno is FacesContext.getCurrentInstance () .getExternalContext () .getSessionMap () .get ("Empno");.
Getting value of scope jspx page session
#{sessionScope.Empno}Hi Samson,.
Here are the groovy expression to access the value of the sessionscope:
adf.context.sessionScope.role
But, as the said John instead to access the session of the model can be a method of model (whether in AMImpl or voImpl) who takes the role as a parameter value and sets the value of the variable binding of the vo, then call this AM from the bean method passing the role value by getting the scope of the session.
Jean Lou
-
Variable binding and View object to filter the results of ADF table
I created a view ADF object where I compare "USERID =: USER_ID" in sql. I created a table with this ViewObject on a .jspx page.
I use the following code in the support to the Bind Variable has a value:
String uidregAMDef =
'mil.navy.comfisc.uid.toolkit.model.UIDToolkitModule ';
String uidregConfig = "UIDToolkitModuleLocal";
Check out the module
UIDToolkitModuleImpl = uidAM
(UIDToolkitModuleImpl) Configuration.createRootApplicationModule (uidregAMDef,
uidregConfig);
ViewObject vo = uidAM.findViewObject("CurrentContent1");
vo.setNamedWhereClauseParam ("USER_ID", 2);
vo.executeQuery ();
Configuration.releaseRootApplicationModule (uidAM, true);
Returns a null value.
}
The result I'm looking for is the TABLE to refresh after that code runs to just display the values where the: USER_ID = 2
However, the table does IS NOT refresh... I do not get a runtime or compile... errors but the picture is not updated, even if the setNamedWhereClauseParam seems well.
Any suggestions? The original Version should not update with the setNamedWhereClauseParam?
Thank you
Published by: [john72] Sep 8, 2008 10:52Hi John72
In your case is more recommended the use of the method of the page definition and iterator, you can add the filter to your page just definition method drag and drop the ExecuteWithParams method as a button of operations in your jsp/jspx page, in the page definition are created automatic ExecuteWithParams and var bind method, you can now create an action of your button and add the following code :
public String commandButton1_action() {}
DCIteratorBinding iter = (DCIteratorBinding) bindings.get ('variables');
iter.getBindingContainer () .getVariableManager () .setVariableValue ("MyVar", "value");execute the method
BindingContainer links = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("ExecuteWithParams");
Object result = operationBinding.execute ();
If (! operationBinding.getErrors () .isEmpty ()) {}
Returns a null value.
}
}Good luck
-
Variable binding defined in LOV
Hi, I use JDev 11.1.1.7
I have a VO (FundingNameVO) which takes in bind variable.
FundingNameVO is used as LOV in an another VO (ProjectVO) for a FundingName attribute.
ProjectVO also has an attribute FundingSource has also a LOV.
When FundingSource is selected, the value must be sent to the liaison FundingNameVO variable to determine the LOV to display for FundingName,
How to pass the FundingSource value to the variable of FundingNameVO binding?
Thank you.
Hello
If the value of the variable binding from attribute ProjectVO follow these steps:
in tab display accessor is ProjectVO, you have added an instance of FundingNameVO, click the view accessor on Edition, then in the open Panel, you see the bind variable, set the value of the variable binding with the good ProjectVO attribute name
If not check this: http://www.jobinesh.com/2011/03/initializing-bind-variables-in-query.html
Kind regards
Habib
-
How can I pass a value to a variable binding in a report query?
I did a query of report to print a PDF report, with a dinamyc source query that has a connection variable, like this:
SELECT EMPNO, EMPNAME, EMPDEPT
FROM EMP
WHERE EMPNO =: PARAMETER;
I want to call the report print directly from a page, by using the url print showed by apex:
f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = MYREPORT
How can I pass the value of the variable binding: PARAMETER using this URL?
I don't think you can use the url parameter passes in a report query.
the binding variable: PARAMETER must be a page element or an element of the application.
use the "include session information and application" in the defination of report query to bind the value when the report is run
-
Reg: Cardinality Feedback for queries with variable bind
Hi all
One of my query (having no bind variables) takes a lot of time (10 minutes) to run for the second run.
I came to know that its due to the feedback of the cardinality.
I disabled _optimer_use_feedback for help and the query has been run within 2 seconds.
If I disable _optimizer_use_feedback at the instance level, is there a problem for queries with variable bind?
> Sorry! I'm not suppose to disclose the NAMES OF THE TABLES
OK, no problem and I take this restriction as a chance to learn what is cardinality comments, and similar expressions. Now, since you can't explain post program for our help, I would try to explain what is comments of cardinality and similar expressions: (since you did not mention Oracle version, so I guess it's 11.2.0.1)
In the Oracle 11.2.0.1 database some SQL statements returns significantly different lines i.e. for some SQL statements earlier execution plan there are has 100 lines by optimizer in the first plan of execution and, where the same SQL statement executed, based optimizer 1000 lines. This happens because of several cursors for child for a single SQL statement and change bind peeking, collection of statistics, characteristic of re-optimizing 11.2.0.1, permission to referenced objects, ACS (Adaptive Cursor sharing) etc. The preaching of changes to lines due to above reasons as well regarding also the SQL statements that are not contains the variable i.e. AKA vibration cardinality of liaison function.
I will highly recommend to read other links below:
Cardinality feedback | Notebook of the Oracle
http://www.centrexcc.com/tuning%20by%20Cardinality%20Feedback.ppt.PDF
https://blogs.Oracle.com/optimizer/entry/cardinality_feedback
Concerning
Girish Sharma
-
How not to display variable binding in the query ADF search panel?
Hello, I use JDeveloper 11.1.2.3.0.
I have a variable binding in my VO, (* required) that I use in the sql query. I put the value of this variable to link through the groovy expression so I don't have to manually put through my page. It works fine but the problem is that it appears in the query ADF Panel that I created in my page. To do this, I created a ViewCriteria and I've specified to display only 3 (other) fields for the simple search. Apart from the selected 3 variable bind shows here again because its value is set. I tried to remove the ' * required ' of the variable binding in the original Version, but in this case I have problems with my sql query.
Does anyone know how this variable is not to display in the Panel request ADF?
Thank you
Has tried to define the binding to bee hidden variable?
Controll tips, hint of display = hide
-
How to set the value of the variable bind in VO on page load?
Hello, I use JDeveloper 11.1.2.3.0.
I created a VO in my application that uses a variable binding in the where clause. I want to put the value of this variable on the loading of the page automatically.
I read that I can do this through setNamedWhereClauseParam()... but I can't find out where and how to use it.
Can anyone help please?
You can put in different places:
AppModuleImpl,
ViewObjectImpl,
ViewRowImpl
Just him export the customer interface and use whenever you want
-
Display variable binding like a LOV element in the user interface.
Hello
I had a thought, if we can create a variable of a viewObject as LOV element binding. This I would like to have this because, according to the value that I choose to the LOV to the variable binding, I'll be able to rerun the query of the viewObject that belongs to the variable binding.
Is that can be done in jdeveloper 11.1.1.4?This video can help you
https://blogs.Oracle.com/Shay/entry/adding_an_lov_to_a_query_param -
Definition of variables bind to VO JUnit test cases
Hello
I use Jdeveloper 11.1.2.2
I have a problem when writing to VO to JUnit test case.
For the Remove method in the Test case, I spent variables in the t by using a setWhereClause().
Like this:
But he demonstrated a a mistake as the bind variables are not defined.view.setWhereClause(null); String whereClause = "location_id = '" + newUpdatedLocationId + "' AND organization_id = '" +newOrganizationId + "'" ; view.setWhereClause(whereClause); view.executeQuery(); while (view.hasNext()) { view.next(); view.removeCurrentRow(); } fixture1.getApplicationModule().getTransaction().commit();
So, how do I access variable Bind programmatically and set the values?
Thank you
Nigel.setNamedWhereClauseParam() is used to set the bind variables
Maybe you are looking for
-
Extend a network of comments with AEBS and TC set up a connection
Hi all- I was wondering if anyone has had any success with that extends a network invited on two airports or more that are wired together. I use currently a Time Capsule as my main router (802.11ac), and have it configured with DHCP and NAT like fas
-
My screen shows only 3/4S of the screen. How can I maximize full screen?
original title: full screen My screen opens to 0. What is necessary for me to open in full screen?
-
Phones ringtones smart blackBerry OS 6
Hi all! I just bought a new curve 9300 yesterday and I noticed that a lot of ringtones that were in O.S. 5 not 6. Anyone know how to get them? I'm looking for 'sonar' and the 'carillon star." Please let me know. Thank you -Brian
-
Windows Firewall authorization driver is missing, cannot start the firewall, why?
Hello so, I noticed that my firewall of windows 7 has been disabled. I tried you turned on (control of configuration\systeme and securite\pare) using the setting, recommended = "firewall Windows cannot change some of your 0x8007042c settings error co
-
Hello I have a SanDisk micro SDHC 8 GB card and an adapter. I have an Acer laptop with a SD card slot.My problem is when I put the micro SDHC into the adapter and then put the card into the slot on the laptop, nothing does appear in 'My computer', so