Setting bind variable to a different value if its null
Hi,
I have a report page which displays a table. One of the parameters of the sql query that generates this table is an apex bind variable.
I want the page to to run a different sql query depending on whether the bind variable is blank or not.
How can I do this in Apex without having to do use a function?
It would be good if I good reset the bind variable to another value (generated from a different sql statement) when the page loads.
Thanks
Edited by: sam on 17-Feb-2011 07:43
Hi,
Thanks, that's really helpful.
I'm passing a value (:P1_VAR1) as null from page 1 to page 2. On page 2 I have a table with the first column showing primary keys that have links.
When the user clicks on the link, it refreshes page 2 and sets the value on session :P1_VAR1 to the value of the primary key of the record clicked.
However, the problem is that when the user goes from page 1 to page 2, I want the :P1_VAR1 to be initialised to the first primary key record from the first record on my table.
I have a function that gets the id of the first record on my table but I don't know how to set the :P1_VAR1 to this value by modifying the item settings in APEX.
Please can someone help and give me an example on how this is done?
Thanks
Edited by: sam on 17-Feb-2011 07:49
Similar Messages
-
How to set bind variable for a VO ,
Hi,
i got a requirement in which i have to set bind variable for VO , But the Bind variable is coming from payload attribute,
For example my query in VO is select * from Employee where emp_id="payload attribute"
How to set this attribute value is from the payload
Thanks Regard
RajendarHi i am getting this exception " Cannot create an object of type:java.lang.Number from type:oracle.bpel.services.datacontrol.data.DataObject with value:21159"
Actually i am getting Decimal Value from Payload of BPEl process and i am trying to set this to The bind variable
is that a type cast exception where can i typeCast Those values You should this in a new thread.Dont ask questions out of the scope of this thread.
Please mark this thread as answered or helpful if you got solution for this thread.
Thanks!!! -
How to set bind variables for child VO in hierarchy component?
Hi,
Recently I created a application with Hierarchy Component with Parent VO (Query based VO with Bind variables in it) and its Child VO along with Child-Child VO(Query based VO with bind variable in it)
I am able to set bind variable of parent VO but unable to set bind variable for Child-Child VO. Can any one help me regarding this issue?Hi i am getting this exception " Cannot create an object of type:java.lang.Number from type:oracle.bpel.services.datacontrol.data.DataObject with value:21159"
Actually i am getting Decimal Value from Payload of BPEl process and i am trying to set this to The bind variable
is that a type cast exception where can i typeCast Those values You should this in a new thread.Dont ask questions out of the scope of this thread.
Please mark this thread as answered or helpful if you got solution for this thread.
Thanks!!! -
Is it possible to set bind variable for picklist?? for messageChoice
we are trying to develop one new page in local JDeveloper.
we have requirement for passing a bind variable to a picklist. is it possible?
Item Type : messageChoice
Query:
SELECT DISTINCT TO_CHAR (effective_date, 'YYYY') TYPE
FROM pay_assignment_actions a, pay_payroll_actions b
WHERE a.payroll_action_id = b.payroll_action_id
AND assignment_id =
(SELECT assignment_id
FROM per_assignments_x
WHERE person_id = :person_id AND primary_flag = 'Y'
AND assignment_type = 'E')
AND a.action_status = 'C'
AND b.payroll_action_id IN (SELECT payroll_action_id
FROM pay_payroll_actions_v
WHERE action_type IN ('P'))
AND b.payroll_action_id IN (SELECT payroll_action_id
FROM xxilo_pre_payments)
ORDER BY 1 DESC
processRequest() code:
PayslipAMImpl am=(PayslipAMImpl)pageContext.getApplicationModule(webBean);
YearPicklistVOImpl yvo=(YearPicklistVOImpl)am.getYearPicklistVO1();
Number t = new Number(pageContext.getEmployeeId());
yvo.setWhereClauseParams(null);
yvo.setWhereClauseParam(0,t);
for this query & code we are getting
ERROR:
java.sql.SQLException: Missing IN or OUT parameter at index:: 1
if we hardcoded person_id in query to some value then we are getting results without any error.user603084 ,
In the query you have specifies bind variable as :person_id , but in your VO execution code you are setting value for bind variable :1
yvo.setWhereClauseParam(0,t);
You need to change the bind variable in query , like :1
and then execute the query of VO, as you have done. Also do executeQuery, after setting bind variables.
--Mukul -
Apex listener installed no test and set bind variables buttons
I have installed Apex listener and while creating restful service module i dont see test and set bind variables buttons in the source region.
I went through the many posts. Installed apex listener successfully.
getting http://localhost:8080/ords/ started message when i start the listener.
and using Apex URL as http://localhost:7780/pls/htmldb.
What are the possibilities for this issues?
Please help me on this.
Thanks
ChandranApex listener version is 2.0.9
Apex version is 4.2 -
Situation:
SSIS Package designed in SQL Server 2012 - SQL Server Data Tools
Windows 7 - 64 bit.
The package (32 bit) extracts data from a SQL Server db to an Excel Output file, via an OLE DB connection.
It uses 3 package variables:
*) SQLCommand (String) to specify the SQL Statement to be executed by the package
Property path: \Package.Variables[User::ExcelOutputFile].Properties[Value]
Value: f:\Output Data.xls
*) EXCELOutputFIle (String) to specify path and filename of the Excel output file
Property path: \Package.Variables[User::SQLCommand].Properties[Value]
Value: select * from CartOrder
*) VarObjectDataSet (Object) to hold the data returned by SQL Server)
Property path: \Package.Variables[User::VarObjectDataSet].Properties[Value]
Value: System.Object
It consists out of 2 components:
*) Execute SQL Task: executes the SQL Statement passed on via a package variable. The resultng rows are stored in the package variable VarObjectDataSet
*) Script Task: creates the physical output file and iterates VarObjectDataSet to populate the Excel file.
Outcome and issue:The package runs perfectly fine both in SQL Server Data Tools itself and in DTEXECUI.
However, whenever I run it via SQL Server Agent (with 32 bit runtime option set), it returns the errror message below.
This package contains 3 package variables but the error stating that a package variable can not be set, pops up for the VarObjectDataSet only. This makes me wonder if it is uberhaupt possible to set the value of a package variable
of type Object.
Can anybody help me on this please ?
Message
Executed as user: NT Service\SQLSERVERAGENT. Microsoft (R) SQL Server Execute Package Utility Version 11.0.2100.60 for 32-bit Copyright (C) Microsoft Corporation. All rights reserved. Started: 6:40:20 PM DTExec: Could
not set \Package.Variables[User::VarObjectDataSet].Properties[Value] value to System.Object. Started: 6:40:20 PM Finished: 6:40:21 PM Elapsed: 0.281 seconds. The package execution failed. The step failed.
Thank you very much in advance
JurgenHi Visakh,
thank you for your reply.
So, judging by your reply, not all package variables used inside a package need to be set a value for when run in DTEXEC ?
I already tried that but my package ended up in error (something to do with "... invocation ...." and that error is anything but clearly documented. Judging by the error message itself, it looks like it could be just about anything. that is why I asked my
first question about the object type package variable.
Now, I will remove it from the 'set values' list and try another go cracking the unclear error-message " ... invocation ...". Does an error message about " ... invocation ..." ring any bells, now that we are talking about it here ?
Thx in advance
Jurgen
Yes exactly
You need to set values only forthem which needs to be controlled from outside the package
Any variable which gets its value through expression set inside package or through a query inside execute sql task/script task can be ignored from DTExec
Ok I've seen the invocation error mostly inside script task. This may be because some error inside script written in script task. If it appeared after you removed the variable then it may because some reference of variable existing within script task.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Best Practice for setting bind variable when application loads
I am using JDeveloper 11.1.2.3.
When my application loads, the first unbounded page has a table populated by a named query.
I would like to set the parameter used by the named query when the page loads, to populate the initial data that is displayed.
What is the best practice for a solution to this issue?user6003393 wrote:
I am using JDeveloper 11.1.2.3.
When my application loads, the first unbounded page has a table populated by a named query.
I would like to set the parameter used by the named query when the page loads, to populate the initial data that is displayed.
What is the best practice for a solution to this issue?Hi,
You can set the bind variable on VO by overriding prepareSession() method in Application Module check this http://docs.oracle.com/cd/E37975_01/web.111240/e16182/bcservices.htm#sthref357
Setting bind variable on runtime http://docs.oracle.com/cd/E37975_01/web.111240/e16182/bcquerying.htm#CHDECJHD
Zeeshan -
Getting error 025036 while setting bind variable value
Hi,
I have created a view object (ViewObj) having bind variable (Bind_Val).
I am writing custom java method in AppModuleImpl.java, so that I can use that in serviceInterface.
my method is:
public void Met(String a){
ViewObjImpl vo=new ViewObjImpl();
vo.setBind_Val(a);
I tried the below method also:
public void Met(String a){
ViewObjectImpl vo=new ViewObjectImpl();
vo.setNamedWhereClauseParam("Bind_Val",a)
But when I am running the AppModuleServiceImpl.java and select the Met method and pass the value for a. It is giving me error 02036.
How to set the bind variable value in AppModuleImpl.java??
Thanks,
RohitHi Frank,
Thanks for reply. It was helpful.
Please go through the below mentioned two queries.
My sql query is:
SELECT Message.MESSAGE_ID,
MessageProp.VALUE,
MessageProp.MSG_PROP_ID
FROM MESSAGE Message, MESSAGE_PROP MessageProp
WHERE (MessageProp.Key='From' OR MessageProp.Key='To')AND Message.MESSAGE_ID = MessageProp.MESSAGE_ID And MessageProp.Value='B'
and I have created one view criteria where I am giving the condition as MessageId=:Bind_MessageId.
And then I am executing my findViewCriteria method from AppModuleServiceImpl where I am passing the value for Bind_MessageId and I am getting the output as I want.
Now I am modifying my query as:
SELECT Message.MESSAGE_ID,
MessageProp.VALUE,
MessageProp.MSG_PROP_ID
FROM MESSAGE Message, MESSAGE_PROP MessageProp
WHERE (MessageProp.Key='From' OR MessageProp.Key='To')AND Message.MESSAGE_ID = MessageProp.MESSAGE_ID And MessageProp.Value=:Bind_Value
and setting the value for :Bind_Value programatically as:
public void test(String s){
ViewObjectImpl view = this.getViewObj1();
VariableValueManager vm = view.ensureVariableManager();
vm.setVariableValue("Bind_Value",s);
**Note- I have written this custom method in AppModuleImpl.java class
Then firstly I am executing test method from AppModuleServiceImpl to set the value for :Bind_Value. After that I am executing findViewCriteria method but then I am not getting any record.
**Note-I am not getting any error.
I want to set Bind_Value programatically and then I want to execute my FindViewCriteria from serviceInterface.
Thanks,
Rohit -
Setting bind variable value programmatically for master and child VO's
Defined following BC:
Serv VO - Master VO, has Bind_cNum (bind variable)
ServDetail VO - Child VO, has Bind_cNum2 (bind variable)
ServViewLink VL - View link between Serv VO & ServDetail VO
in AMModule Impl have custom WS:
public List<ViewRowImpl> getMyServices(String cNum)
List<ViewRowImpl> result = new ArrayList<ViewRowImpl>();
ViewObjectImpl vo1 = getServ(); //Master VO
vo1.setNamedWhereClauseParam("Bind_cNum", cNum);
vo1.setForwardOnly(true);
ViewObjectImpl vo2 = getServDetail(); //Child VO
vo2.setNamedWhereClauseParam("Bind_cNum2", cNum);
vo1.executeQuery();
while (vo1.hasNext()) {
result.add((ViewRowImpl)vo1.next());
return result;
I am passing same cNum parameter to both Serv VO (Master VO) and ServDetail VO (child VO) as above. (this is in addition to view link bind variable :Id)
It shows in the logs that it is setting the values correctly:
<ViewRowSetImpl> <setNamedWhereClauseParam> [382] Serv ViewRowSetImpl.setNamedWhereClauseParam(Bind_cNum, 11771370)
<ViewRowSetImpl> <setNamedWhereClauseParam> [383] ServDetail ViewRowSetImpl.setNamedWhereClauseParam(Bind_cNum2, 11771370)
<ViewRowSetImpl> <doSetWhereClauseParam> [383] Serv ViewRowSetImpl.doSetWhereClause(-1, Bind_cNum, 11771370)
<ViewRowSetImpl> <execute> [385] Serv ViewRowSetImpl.execute caused params to be "un"changed
<OracleSQLBuilderImpl> <bindParamValue> [394] Binding param "Bind_cNum": 11771370
<ADFLogger> <addContextData> Execute query
-- when executing view link
<ViewRowSetImpl> <setParamValues> [425] ServViewLink_0 ViewRowSetImpl.setParamValues params changed
<ViewRowSetImpl> <doSetWhereClauseParam> [426] ServViewLink_0 ViewRowSetImpl.doSetWhereClause(-1, Bind_cNum2, null)
<ViewObjectImpl> <bindParametersForCollection> [436] For RowSet : ServViewLink_0
<OracleSQLBuilderImpl> <bindParamValue> [437] Binding null of type 12 for "Bind_cNum2"
<OracleSQLBuilderImpl> <bindParamValue> [438] Binding param "Bind_Id": 5018
from above log, when ServViewLink_0 is executed, it is changing Bind_cNum2 bind variable to null.
how can i pass same bind variable value to both Master and Child view objects from AM Impl.java
Edited by: bsrao on Oct 11, 2012 6:07 PM
Edited by: bsrao on Oct 11, 2012 6:10 PM
Edited by: bsrao on Oct 11, 2012 6:12 PMTry executing the vo1 query before setting the bind variable for vo2, then execute the vo2 query (if that's what you want to do).
-
Problem in setting bind variable
Hi,
I am sorry but I think I am having problem with this simple ADF BC concept.
I created a View object from HR Schema and I wanted to filter it with department id
so I created a bind variable :dept_id.
<?xml version="1.0" encoding="windows-1252" ?>
<!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
<!---->
<ViewObject
xmlns="http://xmlns.oracle.com/bc4j"
Name="EmployeesView"
Version="11.1.1.59.23"
SelectList="Employees.EMPLOYEE_ID,
Employees.FIRST_NAME,
Employees.LAST_NAME,
Employees.EMAIL,
Employees.PHONE_NUMBER,
Employees.HIRE_DATE,
Employees.JOB_ID,
Employees.SALARY,
Employees.COMMISSION_PCT,
Employees.MANAGER_ID,
Employees.DEPARTMENT_ID"
FromList="EMPLOYEES Employees"
BindingStyle="OracleName"
CustomQuery="false"
PageIterMode="Full"
UseGlueCode="false"
Where="Employees.DEPARTMENT_ID = :dept_id"
RowClass="com.test.view.EmployeesViewRowImpl"
ComponentClass="com.test.view.EmployeesViewImpl">
<DesignTime>
<Attr Name="_codeGenFlag2" Value="Access|Coll|VarAccess"/>
<Attr Name="_isCodegen" Value="true"/>
</DesignTime>
<Variable
Name="dept_id"
Kind="viewcriteria"
Type="oracle.jbo.domain.Number"/>
<ViewAccessor
Name="JobsView1"
ViewObjectName="com.test.view.JobsView"
RowLevelBinds="true"/>
<ViewAccessor
Name="EmployeesView1"
ViewObjectName="com.test.view.EmployeesView"
RowLevelBinds="true"/>
<ViewAccessor
Name="DepartmentsView1"
ViewObjectName="com.test.view.DepartmentsView"
RowLevelBinds="true"/>
<ListBinding
Name="LOV_JobId"
ListVOName="JobsView1"
ListRangeSize="10"
NullValueFlag="none"
NullValueId="LOV_JobId_LOVUIHints_NullValueId"
MRUCount="0">
<AttrArray Name="AttrNames">
<Item Value="JobId"/>
</AttrArray>
<AttrArray Name="ListAttrNames">
<Item Value="JobId"/>
</AttrArray>
<AttrArray Name="ListDisplayAttrNames">
<Item Value="JobTitle"/>
</AttrArray>
<DisplayCriteria/>
</ListBinding>
<ListBinding
Name="LOV_ManagerId"
ListVOName="EmployeesView1"
ListRangeSize="-1"
NullValueFlag="start"
NullValueId="${adfBundle['oracle.javatools.resourcebundle.SystemBundle']['NULL_VALUE_RESID']}"
MRUCount="0">
<AttrArray Name="AttrNames">
<Item Value="ManagerId"/>
</AttrArray>
<AttrArray Name="ListAttrNames">
<Item Value="EmployeeId"/>
</AttrArray>
<AttrArray Name="ListDisplayAttrNames">
<Item Value="FirstName"/>
<Item Value="LastName"/>
</AttrArray>
<DisplayCriteria/>
</ListBinding>
<ListBinding
Name="LOV_DepartmentId"
ListVOName="DepartmentsView1"
ListRangeSize="-1"
NullValueFlag="start"
NullValueId="${adfBundle['oracle.javatools.resourcebundle.SystemBundle']['NULL_VALUE_RESID']}"
MRUCount="0">
<AttrArray Name="AttrNames">
<Item Value="DepartmentId"/>
</AttrArray>
<AttrArray Name="ListAttrNames">
<Item Value="DepartmentId"/>
</AttrArray>
<AttrArray Name="ListDisplayAttrNames">
<Item Value="DepartmentName"/>
</AttrArray>
<DisplayCriteria/>
</ListBinding>
<EntityUsage
Name="Employees"
Entity="com.test.Employees"/>
<ViewAttribute
Name="EmployeeId"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="EmployeeId"
EntityUsage="Employees"
AliasName="EMPLOYEE_ID"/>
<ViewAttribute
Name="FirstName"
PrecisionRule="true"
EntityAttrName="FirstName"
EntityUsage="Employees"
AliasName="FIRST_NAME"/>
<ViewAttribute
Name="LastName"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="LastName"
EntityUsage="Employees"
AliasName="LAST_NAME"/>
<ViewAttribute
Name="Email"
IsUnique="true"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="Email"
EntityUsage="Employees"
AliasName="EMAIL"/>
<ViewAttribute
Name="PhoneNumber"
PrecisionRule="true"
EntityAttrName="PhoneNumber"
EntityUsage="Employees"
AliasName="PHONE_NUMBER"/>
<ViewAttribute
Name="HireDate"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="HireDate"
EntityUsage="Employees"
AliasName="HIRE_DATE"/>
<ViewAttribute
Name="JobId"
LOVName="LOV_JobId"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="JobId"
EntityUsage="Employees"
AliasName="JOB_ID">
<Properties>
<SchemaBasedProperties>
<CONTROLTYPE
Value="combo_lov"/>
</SchemaBasedProperties>
</Properties>
</ViewAttribute>
<ViewAttribute
Name="Salary"
PrecisionRule="true"
EntityAttrName="Salary"
EntityUsage="Employees"
AliasName="SALARY"/>
<ViewAttribute
Name="CommissionPct"
PrecisionRule="true"
EntityAttrName="CommissionPct"
EntityUsage="Employees"
AliasName="COMMISSION_PCT"/>
<ViewAttribute
Name="ManagerId"
LOVName="LOV_ManagerId"
PrecisionRule="true"
EntityAttrName="ManagerId"
EntityUsage="Employees"
AliasName="MANAGER_ID">
<Properties>
<SchemaBasedProperties>
<CONTROLTYPE
Value="choice"/>
</SchemaBasedProperties>
</Properties>
</ViewAttribute>
<ViewAttribute
Name="DepartmentId"
LOVName="LOV_DepartmentId"
PrecisionRule="true"
EntityAttrName="DepartmentId"
EntityUsage="Employees"
AliasName="DEPARTMENT_ID">
<Properties>
<SchemaBasedProperties>
<CONTROLTYPE
Value="choice"/>
</SchemaBasedProperties>
</Properties>
</ViewAttribute>
<ViewLinkAccessor
Name="EmployeesView"
ViewLink="com.test.view.EmpManagerFkLink"
Type="oracle.jbo.RowIterator"
IsUpdateable="false"/>
<ViewLinkAccessor
Name="DepartmentsView"
ViewLink="com.test.view.DeptMgrFkLink"
Type="oracle.jbo.RowIterator"
IsUpdateable="false"/>
</ViewObject>But when I ran it in my Business Component Browser, I am encountering below error
java.sql.SQLException: Missing IN or OUT parameter at index:: 1Not sure but did I miss something? Thanks
JDEV 11G PS3Hi Frank,
Thanks, I think thats the gotcha...
setting the bind variable to required causes the dialog to appear...
Not sure though if this is a bug or something.. -
How can I set bind parameter as Default Display Value in JHeadstart
Hi,
I am using -
JDeveloper Studio Edition Version 10.1.3.1.0.3984
JHeadstart Release 10.1.3.1.26
Can anybody help me for the following:
I am using a super class of ViewObjectImpl where I am definning a bind parameter (Student ID) using login userid:
if ("p_std_id".equals(bindParam[0])) {
sLog.debug("executeQueryForCollection: found bind param p_std_id, setting value to " + studentNumber_from_LDAP);
bindParam[1] = studentNumber_from_LDAP;
Then I defined p_std_id in Bind Variables tab in VO Editor and used that in Where clause in the SQL Statement tab.
This is working fine.
Now what I want to do is:
I want to put the value of p_std_id as Default Display Value for a field.
Can anybody let me know how I can put the value of p_std_id in JHeadstart Application Definition?
Thanks
Syed Jabbar
University of Windsor
Windsor, ON, CanadaHi Jan and Steven,
Thanks for your reply.
I need to show the default value in the table layout.
Steven, could you please give some more hints about EL Expression?
To obtain the value of p_std_id now and pass it on as bind param, I am using a class extending ViewObjectImpl. Inside that class I am using the following method:
I'd appreciate if you could help for the EL Expression.
Thanks
protected void executeQueryForCollection(Object Object, Object[] bindParams,
int i) {
String userId = ((ApplicationModuleImpl)getApplicationModule()).getUserPrincipalName();
try{
getLdapInfo(userId);
catch(Exception e) {
sLog.debug("executeQueryForCollection: Userid = " + userId);
if (bindParams != null)
for (int j = 0; j < bindParams.length; j++)
Object[] bindParam = (Object[])bindParams[j];
if ("p_user_id".equals(bindParam[0])) {
sLog.debug("executeQueryForCollection: found bind param p_user_id, setting value to " + userId);
bindParam[1] = userId;
if ("p_emp_id".equals(bindParam[0])) {
sLog.debug("executeQueryForCollection: found bind param p_emp_id, setting value to " + employeeNumber_from_LDAP);
bindParam[1] = employeeNumber_from_LDAP;
if ("p_std_id".equals(bindParam[0])) {
sLog.debug("executeQueryForCollection: found bind param p_std_id, setting value to " + studentNumber_from_LDAP);
bindParam[1] = studentNumber_from_LDAP;
super.executeQueryForCollection(Object, bindParams, i);
Thanks
Syed -
Setting bind variable for a view object from the Managed Bean
Hi,
i am using JDeveloper 11g, i have to create LOV in the JSF. To show the LOV, it has to populate data using View object and its query parameter need to be sent from the Managed Bean.
For the View object i want to set the bind variable parameter from the managed bean value. bename is stored in a managed bean (session scope)
#{beantest.bename}
But it gives the following exception.
JBO-29000: Unexpected exception caught:
org.codehaus.groovy.control.MultipleCompilationErrorsException,msg=startup failed, Script1.groovy: 1: expecting '!',found '{'@ line1, column 2.
I have followed the link http://kr.forums.oracle.com/forums/thread.jspa?threadID=615474 like Frank wrote on 8.2.2008:
But steps are not clear.
How to input the VO bind parameter with Managed bean variable?
Any Help
Regards
Raj
Edited by: user9928180 on Dec 17, 2008 9:51 AMHi,
a bind variable in a VO needs to be exposed as an executeWithParams operation in the pageDef file. Just add a new action binding to the pageDef file (context menu) and select the executeWithParams operation on teh VO. Then in the argument field, reference the managed bean property for the value
Frank -
Conditionally Setting Bind Variables
I need help conditionally setting some bind variables so I don't have to hard code some values. However, I get errors when I try to do this. I might just be going about it the wrong way. This is my code so far:
DECLARE
first_offset varchar2(3);
second_offset varchar2(3);
current_term varchar2(6);
BEGIN
current_term := (SELECT robinst_current_term_code
FROM robinst
WHERE robinst_aidy_code = :aidy)
CASE
WHEN current_term LIKE '%60' THEN first_offset := '40'
AND second_offset := '100'
WHEN current_term LIKE '%20' THEN first_offset := '100'
AND second_offset := '160'
END
END;
/I want to then use the offest variables in a select query afterwords. Is this possible, or what do I appear to be doing wrong?
Edited by: blackhole82 on Jan 23, 2009 2:01 PM
Edited by: blackhole82 on Jan 23, 2009 2:07 PMThis works when I run it in toad:
VARIABLE first_offset varchar2(3)
VARIABLE second_offset varchar2(3)
VARIABLE current_term varchar2(6)
BEGIN
SELECT robinst_current_term_code
INTO current_term
FROM robinst
WHERE robinst_aidy_code = :AIDY;
first_offset := CASE
WHEN current_term LIKE '%60' THEN '40'
WHEN current_term LIKE '%20' THEN '100'
END;
second_offset := CASE
WHEN current_term LIKE '%60' THEN '100'
WHEN current_term LIKE '%20' THEN '160'
END;
END;
SELECT spriden_id id, spriden_last_name||', '||spriden_first_name name
FROM spriden
WHERE spriden_pidm IN(
SELECT DISTINCT(RCRESAR_PIDM)
FROM RCRESAR A,RCRAPP1,SGBSTDN,SORLCUR, RCRAPP2, ROBINST
WHERE (RCRESAR_PELL_ELGBL = 'Y')
AND RCRAPP1_BIRTH_DATE <= (SELECT trunc(sysdate) - interval '25'year from dual)
AND RCRAPP1_CITZ_IND='1'
AND RCRAPP1_CURR_REC_IND='Y'
AND RCRAPP1_INFC_CODE = 'EDE'
AND SGBSTDN_STYP_CODE = 'C'
AND SGBSTDN_STST_CODE = 'AS'
AND SGBSTDN_LEVL_CODE = 'UG'
AND (SORLCUR_DEGC_CODE LIKE 'B%'
OR SORLCUR_DEGC_CODE LIKE 'A%')
AND SORLCUR_CACT_CODE='ACTIVE'
AND ((RCRAPP2_C_DEPEND_STATUS='2'
AND (RCRAPP1_STAT_CODE_RES='LA'
OR RCRAPP1_PAR_STAT_CODE_RES='LA'))
OR (RCRAPP2_C_DEPEND_STATUS='1'
AND RCRAPP1_STAT_CODE_RES='LA'))
AND F_ENROLLED_THIS_TERM(RCRESAR_PIDM, :current_term - :first_offset) = 'Y'
AND MSU_ENROLLED_HISTORY_TERM(RCRESAR_PIDM, :current_term - :second_offset) = 'Y'
AND NOT EXISTS (SELECT 'X'
FROM RPRAWRD
WHERE RCRESAR_PIDM = RPRAWRD_PIDM
AND RCRESAR_AIDY_CODE = RPRAWRD_AIDY_CODE
AND RPRAWRD_FUND_CODE LIKE 'GO%')
AND RCRAPP1_PIDM = RCRESAR_PIDM
AND SGBSTDN_PIDM = RCRESAR_PIDM
AND SORLCUR_PIDM = RCRESAR_PIDM
AND RCRAPP2_PIDM = RCRESAR_PIDM
AND RCRESAR_INFC_CODE = RCRAPP1_INFC_CODE
AND RCRESAR_SEQ_NO = RCRAPP1_SEQ_NO
AND RCRAPP2_INFC_CODE = RCRAPP1_INFC_CODE
AND RCRAPP2_SEQ_NO = RCRAPP1_SEQ_NO
AND RCRAPP1_AIDY_CODE = RCRESAR_AIDY_CODE
AND RCRAPP2_AIDY_CODE = RCRESAR_AIDY_CODE
AND ROBINST_AIDY_CODE = RCRESAR_AIDY_CODE
AND RCRESAR_AIDY_CODE = :AIDY
/*AND RCRESAR_PIDM = :PIDM */
INTERSECT
SELECT rprawrd_pidm
FROM rprawrd
WHERE rprawrd_fund_code = 'PELL'
AND rprawrd_offer_amt > 0
AND rprawrd_aidy_code = :AIDY
INTERSECT
SELECT rprawrd_pidm
FROM rprawrd
WHERE rprawrd_fund_code LIKE 'GO%'
AND rprawrd_paid_amt > 0
AND rprawrd_aidy_code <> :AIDY
AND spriden_change_ind IS NULL
ORDER BY nameBut it prompts me for my bind variables: current_term, first_offset, and second_offset. If I don't type in values I get no rows returned. When I type in what should be getting set in my pl/sql block it works fine. What could be the problem now? The purpose of the variables is to not to have to type anything.
Edited by: blackhole82 on Jan 23, 2009 3:28 PM -
About dynamically setting bind variable in LOV View
Hi,
I have a LOV VO for an af:SelectOneChoice field in the page.
The LOV is depended on an SQL statement in which there is a bind variable in the where clause.
When I open the page, I set the bind variable by using VO.setNamedWhereClauseParam in the prepareSession method in the application module, followed by VO.executeQuery();
The problem is, the af:SelectOneChoice is blank. Why?
If I do not use the bind variable in the SQL, I can see rows in the af:SelectOneChoice field.
When is the proper time to populate the LOV? And where should I put the code for populating the LOV?
I am sure that the VO is populated, because after I executeQuery, there are many rows in the VO.
Thanks
Stephen
nullHi Franky,
Yes, when I set a default value for the bind variable, everything is OK.
But I want the bind variable dynamically be set when the AM is initiated. Is there a way to do that?
Stephen -
How to set Bind variable on the action of command link
I have two tables. One is the list of processes and other one is the details of processes with process name as primary key.
I want to first display the first table which has the list of processes on one page. When I click on perticular process name this process will pass to the bind variable of another table and corresponding details will be shown on other page. can anyone help how I can do this. My code is as follows:
package model;
import model.common.BpelDetailsView;
import oracle.jbo.server.ViewObjectImpl;
public class BpelDetailsViewImpl extends ViewObjectImpl implements BpelDetailsView {
* This is the default constructor (do not remove).
public BpelDetailsViewImpl() {
* Returns the variable value for bpelnameVar.
* @return variable value for bpelnameVar
public String getbpelnameVar() {
return (String)ensureVariableManager().getVariableValue("bpelnameVar");
* Sets <code>value</code> for variable bpelnameVar.
* @param value value to bind as bpelnameVar
public void setbpelnameVar(String value) {
ensureVariableManager().setVariableValue("bpelnameVar", value);
this.executeQuery();
<af:commandLink id="ot3" text="#{row.BpelName}"
action="#{DasboardBean.ot3_action}"/>
public String ot3_action() {
BpelDetailsViewImpl bdv=new BpelDetailsViewImpl();
bdv.setbpelnameVar("#{row.BpelName}");
return "success";
but its not working at all.
Its displaying the errors on click of command link.
javax.servlet.ServletException: java.lang.NullPointerException
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
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:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:147)
at org.apache.myfaces.trinidad.component.UIXTable.broadcast(UIXTable.java:271)
at oracle.adf.view.rich.component.UIXTable.broadcast(UIXTable.java:140)
at oracle.adf.view.rich.component.rich.data.RichTable.broadcast(RichTable.java:364)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:87)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:298)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:91)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:87)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:87)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:298)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:91)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:81)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:673)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
... 34 more
Caused by: java.lang.NullPointerException
at oracle.jbo.server.ComponentObjectImpl.ensureVariableManager(ComponentObjectImpl.java:472)
at model.BpelDetailsViewImpl.setbpelnameVar(BpelDetailsViewImpl.java:32)
at portal.view.bean.DasboardBean.ot3_action(DasboardBean.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
... 54 moreHi Shay..
Thanx for your help...
I stuck in one more problem. When I run directly the first list page it works fine. I craeted one more page home.jspx where I added a golink with <af:golink id="gl1" text ="List" destination="list.jspx". When I click on link it opens the list page. Now when I clicking on first column its redirecting to list.jspx not to details.jspx.
What can be the solution for this.
Maybe you are looking for
-
Connect iBook to Bang&Olufsen Audio System
I have tons of music on my iBook and want to play it through my Bang&Olufson Audio System. Does somebody know how to connect ?
-
Hi I have created a payment advice FBE1 by mistake through F110, where is says generate payment advice I have tried to delete using FBe6, but it states that I can only delete this after 10 days. Is there any other way to delete FBE1. We do not u
-
System 9 - how to reallocate software memory
Hey guys, I went from OS9 to 10.3 about 8 months ago and up to this point I have not had to use system 9. So I loaded an old piece of software recently (Flash) and everything was great until I started getting low memory alerts. I went to the program,
-
Converting D2K form to Oracle apps Form
Hi, How to convert normal d2k form into oracle apps Form. Thanks & Regards, Jayakumar
-
5599 Home Sharing Error - how do I fix it?
5599 Home Sharing Error - how do I fix it?