Oracle – can we call procedure inside a function in PL/SQL?

functionoracleoracle10gplsqlstored-procedures

we can call the function inside the procedure , but is it possible to call procedure inside the function ?
I tried but I can't call procedure inside the function.
could you tell me why we can not call the procedure inside the function?

Best Solution

" I tried but I can't call procedure inside the function."

How did you try? What did you try? In what way did you fail?

Because it is permitted to call procedure inside the function. So if it isn't working for you, then the cause is something wrong in your code. We cannot possibly diagnose that without you providing a lot more information than you currently have.

The two most likely reasons are:

  1. You have a syntax error in your code which is preventing it from compiling, or some other bug which is hurling a runtime exception.

  2. The function might be in scope of the procedure but not vice versa.

  3. Your procedure is doing something which is not allowed when we call a function in a query (such as issuing DML) and you are calling your function in a SELECT statement.