0

I have a query that returns a list of person_id

select person_id from per_all_people_f .

and i have another function that takes person_id as a parameter.

package1.get_person_company(p_person_id)

what i want to do is to get the result as

person_id,get_person_company_result

so the function is invoked with all returned values from the first query. how to achieve that?

1 Answer 1

1

Just call the function for each row:

SELECT person_id,
       package1.get_person_company(p_person_id => person_id)
         AS get_person_company_result
FROM   per_all_people_f
Sign up to request clarification or add additional context in comments.

4 Comments

it worked as expected !,but never seen this syntax before, can you tell me the topic name please?
You are just calling a user-defined function from an SQL statement; it is reasonably basic functionality equivalent to calling a built-in function like TO_CHAR or UPPER.
i meant to say the arrow =>
It is just passing the value to a named parameter rather than passing the value by the position of the parameter. You don't need to use the p_person_id => and can pass the parameters in order (rather than by name) if you want; like this package1.get_person_company(person_id).

Your Answer

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.