Oracle - Calling a parameterized function in a SQL Statement

Posted on 2014-08-25
Last Modified: 2014-08-26
I have a function named MyFunction

MyFunction has two input parameters.

A working SQL call to a function named Function2 with one parameter exists.

MyFunction has 2 parameters instead of 1.
a.Col1, b.Col1

nvl(Function2(a.Col1),' ') AS myComments,

What is the syntax for 2 parameters?

nvl(MyFunction(a.Col1),' ',???) AS myComments,

??? MyFunction(b.Col1)

Question by:Dovberman
    LVL 76

    Expert Comment

    by:slightwv (䄆 Netminder)
    Parameters are comma separated:
    MyFunction (param1, param2)

    If one of the parameters is the result of function2, so be it:
    myfunction(nvl(Function2(a.Col1),' '),'someotherparam')

    From the description I do not understand what you are asking.
    LVL 39

    Accepted Solution

    if you're trying to wrap both in nvl:

    myFunction (
                                 function2(a.col1), ' '
                        nvl(b.col1, ' ')
    LVL 47

    Assisted Solution

    =NVL(   MyFunction (a.Col1, b.Col1)   , ' ' )

    calling a function needing 2 parameters remains the same even inside NVL()

    {+ edit}
    OR, if you need to supply NVLs to the parameters themselves:

     MyFunction (  NVL(a.Col1,'')  , b.Col1)

     MyFunction (  NVL(a.Col1,'')  , NVL(b.Col1,'')  )

    Author Closing Comment

    Thanks. Very complete.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
    Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
    This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now