2

How to function subquery as a function parameter

 select  get_feeTypeamount(SELECT ftp.type_plan_id 
                 FROM tbl_fee_type_plan ftp
       WHERE ftp.type_plan_id=17) as total_amount
2
  • you code have no sense try explain better .. Commented Mar 6, 2017 at 15:42
  • 1
    If you know the query that should be passed why not use it inside your function? There is no way of doing that the way you asked. Only way is to pass the query as string and dynamically execute it inside the function. Commented Mar 6, 2017 at 15:44

1 Answer 1

3

You don't need a sub-query. Just apply the function to the ftp.type_plan_id column in your SELECT.

Something like this should work for you:

SELECT get_feeTypeamount(ftp.type_plan_id) as total_amount 
FROM tbl_fee_type_plan ftp
WHERE ftp.type_plan_id=17
Sign up to request clarification or add additional context in comments.

Comments

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.