Select from table and function
- by David Oneill
I have a function that returns a table. The returned table contains (among other things) a store_id. I can get the store_id for a particular transaction_id and city_id as follows:
select store_id from table(f_get_store(city_id, transaction_id));
I have another table that contains a list of transactions (which includes transaction_id and city_id). I want a query that returns
store_id, city_id, transaction_id
for every entry in the transaction table. My first guess was:
select f_get_store(city_id, transaction_id), city_id, transaction_id
from table;
(simplified away the unimportant details)
However, this yields an "ORA-00932: inconsistent datatypes" error. How do I need to structure this query?
(I'm using Oracle)