All Forums Database
shaves 22 posts Joined 04/15
09 Apr 2015
Error 3707 - when updating prompt

I have 3 prompts in my report: (1) Group Number, (2) State, and (3) Branches. The user selects the group number (1) and the prompt for State (2) is updated with all of the states the group does business in. Then the user selects either "null" or one of the states from the state prompt (2). When they make the state selection, the branches prompt (3) is completed with the sql below:

select distinct
bta.stn_stn_id
from ody.bil_tas_areas bta
where
bta.stpr_id = (select uda.area_id
from ody.usr_dfnd_areas uda
where uda.aty_area_typ = 'tas_a_stpr'
and uda.AREA_DESC = ?)
order by 1

This works good when the user makes any selection but "null". If they select "null" and want to run the report for all states, I would like to see all of the branches for the group number they selected. Currently, the 3rd prompt is empty. I'm not sure how to get all of the branches when "null" is selected.  I did some research and made the following change:
select distinct
bta.stn_stn_id
from ody.bil_tas_areas bta
where bta.stpr_id = (select uda.area_id
from ody.usr_dfnd_areas uda
where uda.aty_area_typ = 'tas_a_stpr'
and (uda.AREA_DESC = ? || '' =  ?)
)
order by 1

When I try to use this code, I’m getting a Teradata Database 93707) Syntax Error, expected something like ')' between a string or a Unicode character liter and '='.  I'm not sure what is wrong.  Any suggestions would be appreciated as I'm new with sql.  Thanks for your help.
I have 3 prompts in my report: (1) Group
 
 
 
 
 

You must sign in to leave a comment.