1

I have a function A and function B.

Function A Name is f_a() and the code is:

Select id,address from A;

Function B Name is f_b() code is:

Select C.address,B.name 
From 
(Select id,name from B,
(Select * from f_a()) as C 
Where C.id = B.id;

However, when I execute the select * from f_b() the Error message says C.id does not exist. How can I run the function f_a() inside f_b().

Above function A and B are functions which returns table. I omitted the function head and end.

Erwin Brandstetter
186k28 gold badges463 silver badges636 bronze badges
asked Nov 29, 2013 at 6:36
1
  • Please always supply complete function definition including the function header, which is an integral part and probably also part of your problem at hand. Commented Dec 1, 2013 at 14:41

1 Answer 1

1

Your syntax is twisted in several ways. If the return type of function A is defined as RETURNS TABLE (id int, address text), it could work like this:

Select A.address, B.name 
FROM f_a() A
JOIN B USING (id);

Aside: While your identifiers look alright for the purpose, I strictly use legal, lower case identifiers to avoid complications.

answered Dec 1, 2013 at 14:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.