I have 2 user parameters:
One that allows user to select the office.
Here is the code:
and the other allows the user to select Attorney:
I reference them in the main query like so:
The problem I'm running into is that the user can select any attorney and it processes corretly. However, if user selects an office, it brings back all offices.
The only thing i can think of is that attorney & office are apart of a hierarchial operation: Attorney -> Lawfirm -> Office.
However, the parameters are not associated (and i don't even know if you can link paramaters) so I don't believe that the office/attorney relationship matters.
I'm new to oracle and sql, I apologize if this is not clear.
Thank you.
One that allows user to select the office.
Here is the code:
Code:
select DISTINCT e.lastname
from t_entity e INNER JOIN t_entityrelationship er
on e.entityid = er.childentityid
INNER JOIN t_relationshiptype r
on er.childrelationshiptypeid = r.relationshiptypeid
where er.parentrelationshiptypeid in
(select r.relationshiptypeid
from t_relationshiptype r
where UPPER(r.relationshiptypedesc) = 'CASE')
and UPPER(r.relationshiptypedesc) = 'OFFICE'
and e.isPrimary = 'Y'
and the other allows the user to select Attorney:
Code:
select DISTINCT e.initials
from t_entity e INNER JOIN t_entityrelationship er
on e.entityid = er.childentityid
INNER JOIN t_relationshiptype r
on er.childrelationshiptypeid = r.relationshiptypeid
where er.parentrelationshiptypeid in
(select r.relationshiptypeid
from t_relationshiptype r
where UPPER(r.relationshiptypedesc) = 'CASE')
and UPPER(r.relationshiptypedesc) = 'ATTORNEY'
and e.isPrimary = 'Y'
I reference them in the main query like so:
Code:
where office.office = :office
or :office is NULL
and WLFattorney.initials = :attorney
or :attorney is NULL
The problem I'm running into is that the user can select any attorney and it processes corretly. However, if user selects an office, it brings back all offices.
The only thing i can think of is that attorney & office are apart of a hierarchial operation: Attorney -> Lawfirm -> Office.
However, the parameters are not associated (and i don't even know if you can link paramaters) so I don't believe that the office/attorney relationship matters.
I'm new to oracle and sql, I apologize if this is not clear.
Thank you.