Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm calling a function from pl/sql, but I do not require the result in this case. Is there a cleaner way to call this function without using a dummy variable?


junk := performWork();

Does not work:

performWork();         --PLS-00221: performWork is not a procedure or is undefined
EXEC performWork();    --this might work from SQL*Plus, but not from pl/sql
SELECT pkg.performWork() FROM DUAL;  --PLS-00428: INTO clause is expected in this SELECT statement
share|improve this question
I suspect this sort of questions is more on-topic at SO. – Yasir Arsanukaev Jun 10 '13 at 14:13
If you don't want the output from a function, why do you need to call it? Normally if something is going to 'perform work', then that something is a procedure, not a function. – Jack Douglas Jun 10 '13 at 14:20
up vote 0 down vote accepted

Your options are:

  1. Assign the result to a dummy variable:

    junk := perform_work;
  2. Select the result into a dummy variable:

    select perform_work into junk from dual;
  3. Create an implicit cursor in a loop:

    for i in ( select perform_work from dual ) loop
    end loop;
  4. If the function does not need to be called from SQL you could change it into a procedure with an OUT parameter, though this still requires a "junk" variable it might look very slightly cleaner?


If you don't want to use this function though, why not just remove it from your code?

The only time I can think of there being a valid use-case for this sort of structure is when you're running identical code in two different schemas/on two different databases but this function is useless in one of them. If that's the case the function is still useful in the other and so you will want to do something with the result anyway.

share|improve this answer
In one case, I need the ID returned by the function for further processing. In the other case I don't. Thought perhaps I was missing some obvious syntax that would allow me to do this. – Matter Jul 19 '13 at 17:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.