I have written a procedure and I need a little help or ideas.
I keep coming up with the error "no data found" I know why I am getting this error, however I am a little new to coding so I need a work around.
select longitude, latitude
into bus_long, bus_lat
from zip.zipcodes
where zip_code = c.zip_5;
this is ran on each record in the procedure so when it encounters a zipcode that is not in one or the other tables i get ther error.
I have found that alot of records where zipcode was null therefore i did an if to check for a null value
Ie if c.zip_5 is not null then
select longitude, latitude
into bus_long, bus_lat
from zip.zipcodes
where zip_code = c.zip_5;
end if;
now this works for nulls but there are other zipcodes not located in the zip_codes table.
How can I verify that the zipcode is a match to the table prior to running the select statement.
I keep coming up with the error "no data found" I know why I am getting this error, however I am a little new to coding so I need a work around.
select longitude, latitude
into bus_long, bus_lat
from zip.zipcodes
where zip_code = c.zip_5;
this is ran on each record in the procedure so when it encounters a zipcode that is not in one or the other tables i get ther error.
I have found that alot of records where zipcode was null therefore i did an if to check for a null value
Ie if c.zip_5 is not null then
select longitude, latitude
into bus_long, bus_lat
from zip.zipcodes
where zip_code = c.zip_5;
end if;
now this works for nulls but there are other zipcodes not located in the zip_codes table.
How can I verify that the zipcode is a match to the table prior to running the select statement.