Selecting with INT value against STR field

55 Views Asked by At

I'm trying to select records from a table using SQL Developer based on an INT value (in one file) to a STR (in the other file) and I'm using a nested(?) query:

select *
from proddta.FQ584871 
where tdrscn in (select rmrscn from proddta.f48310) 
and tdan8 > 1 and tdeqhr > 0 
and tddoco not in (select glsbl from proddta.f0911)

In this example the TDDOCO is an INT and the GLSBL is a STR. The match would be TDDOCO = 456123 to the GLSBL = 00456123.

Thank you for any assistance

I've tried to CAST and the STR and VARCHAR but they don't appear to work when I'm trying to convert the TDDOCO.

I've tried:
tddoco not in (select to_number(ltrim(glsbl,'0')) from proddta.f0911

and I've tried:

to_char(tddoco) not in (select glsbl from proddta.f0911)

and I get an invalid number error.

0

There are 0 best solutions below