Requirement: In this post I will show you how we can programmatically Define, Set, Get and Remove Named Bind Variable from a ViewObject in Oracle ADF
We can define the WHERE Clause, Bind Variable Name and the Default Value by using the below code.
// Get the ViewObject
ViewObject vo = iter.getDepartments();
// Apply desired WHERE Clause and declare the bind variable name
vo.setWhereClause("DEPARTMENT_NAME=:bindDeptName");
// Define this variable as ViewObject Bind Variable. We can also set default value for this
vo.defineNamedWhereClauseParam("bindDeptName", "Marketing", null);
// Execute the ViewObject to finally apply the where clause
vo.executeQuery();For Setting value to the Bind Variable use the below code
// Setting Value to the Bind Variable
vo.setNamedWhereClauseParam("bindDeptName", "IT");
vo.executeQuery();For Getting value from the Bind Variable use the below code
// Getting value from the Bind Variable
vo.getNamedWhereClauseParam("bindDeptName");For Removing the WHERE Clause and the Bind Variable we can use the below code
// Remove the where clause
vo.setWhereClause(null);
// Remove the Bind Variable
vo.removeNamedWhereClauseParam("bindDeptName");
vo.executeQuery();Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
1,185 total views, 3 views today