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?
相关问题
- Keeping track of variable instances
- What is the best way to cache a table from a (SQL)
- How to get the maximum of more than 2 numbers in V
- F#: Storing and mapping a list of functions
- Can I skip certificate verification oracle utl_htt
相关文章
- node连接远程oracle报错
- oracle 11g expdp导出作业调用失败,提示丢包。
- 执行一复杂的SQL语句效率高,还是执行多少简单的语句效率高
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- Accessing an array element when returning from a f
- Difference between FOR UPDATE OF and FOR UPDATE
- Equivalent to window.setTimeout() for C++
- How can I write-protect the Matlab language?
My guess is that you are using
call proc
orexec proc
. See below an example how to call the procedure.However, if your function(or procedures called by your function) does DML, your function can't be used in sql statements.(Can be used only in PLSQL blocks).
I'm going to take a guess here that you have the function declared first, with the procedure following, similar to:
As shown above, with the function declared first you can call the function from the procedure. However, if you try something like the following (function declared before procedure, and function calls procedure):
the compile will fail, because my_func cannot 'see' my_proc. To make it work you need to put in a 'prototype' declaration of my_proc, as follows:
Share and enjoy.
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:
You have a syntax error in your code which is preventing it from compiling, or some other bug which is hurling a runtime exception.
The function might be in scope of the procedure but not vice versa.
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.
--------------------------procedure inside function-----------------------------
-------procedure declaration-----------------
---------procedure called--------------------
----------------------------------execution---------------------------------