Error Message from SQL

I continue to get the same error message over and over for a SQL script that I have. This script runs just fine in TOAD. I have tried a altering the SQL and I have also tried a similar script with the same results.

the Error is:

Exception Messages:
WithOut_BI_in_TBRACCD - ‘BI’ is an unexpected token. Expecting white space. Line 27, position 25.

SQL 1:
select spriden_id from spriden
where spriden_change_ind is null
and spriden_pidm in
(
(select distinct tbraccd_pidm from tbraccd
where tbraccd_term_code = ‘ARTERM’)
minus
(select distinct tbraccd_pidm from tbraccd
where substr(tbraccd_term_code,1,1) in (‘1’,‘2’,‘4’,‘8’,‘9’)
)
minus
(select spraddr_pidm from spraddr
where spraddr_atyp_code = ‘BI’
and spraddr_to_date is null
and spraddr_status_ind is null)
)
and spriden_pidm in
(select tbraccd_pidm from tbraccd
group by tbraccd_pidm
having sum(tbraccd_balance) > 0)
order by spriden_id

SQL 2:
select spriden_id from spriden
where spriden_change_ind is null
and spriden_pidm in
((select distinct tbraccd_pidm from tbraccd
where tbraccd_term_code = ‘ARTERM’
minus
select distinct tbraccd_pidm from tbraccd
where substr(tbraccd_term_code,1,1) in (‘1’,‘2’,‘4’,‘8’,‘9’))
intersect
select tbraccd_pidm
from tbraccd
where tbraccd_atyp_code <> ‘BI’)
and spriden_pidm in
(select tbraccd_pidm from tbraccd
group by tbraccd_pidm
having sum(tbraccd_balance) > 0)
order by spriden_id

I think this is a parser issue. It doesn’t seem to like this part.

select tbraccd_pidm
from tbraccd
where tbraccd_atyp_code ‘BI’

Is the “‘BI’” needed here? Is this trying to be a quoted alias?

Debbie

‘BI’ is needed and no its not an alias - its the data in the database. The tbraccd_atyp_code column contains ‘BI’, ‘MA’, ‘PA’

I have also attempted replacing the ‘=’ with ‘LIKE’ and that did not work either.

I am confused on why this would be a parser issue if it runs fine in TOAD?