Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Oracle - Calling a parameterized function in a SQL Statement

Posted on 2014-08-25
Medium Priority
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 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40284261
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 41

Accepted Solution

Kyle Abrahams earned 1000 total points
ID: 40284296
if you're trying to wrap both in nvl:

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

Assisted Solution

PortletPaul earned 1000 total points
ID: 40285008
=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

ID: 40285317
Thanks. Very complete.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

580 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