Select from table and function
Posted
by David Oneill
on Stack Overflow
See other posts from Stack Overflow
or by David Oneill
Published on 2010-04-19T19:36:20Z
Indexed on
2010/04/19
19:43 UTC
Read the original article
Hit count: 328
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)
© Stack Overflow or respective owner