The difference between call and exec in Oracle Database


I found a little thing today. I found it very interesting. I found some information to share with you

In sqlplus:

Tools provided by third parties (e.g. plsqldev)


Exec is a command of sqlplus and can only be used in sqlplus.

Call is a SQL command, which can be used by any tool. Call must have brackets, that is, the example has no parameters

Call must have parentheses, that is, the instance has no parameters 
idle> connect /as sysdba 
[email protected]> 
[email protected]> create procedure p_test is 
2 begin 
3 null; 
4 end; 
5 / 
Procedure created. 
[email protected]> 
[email protected]> exec p_test 
PL / SQL procedure completed successfully. 
[email protected]> call p_test 
2 ; 
call p_test 
Error on line 1: 
Ora-06576: not a valid function or procedure name 
[email protected]> call p_test(); 
Call completed. 
[email protected]> 
Exec can only be used in sqlplus; call can be used anywhere

The above is the difference between call and exec in Oracle database introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and the editor will reply to you in time. Thank you very much for your support to the developeppaer website!

Recommended Today

Problem connecting to MySQL database

mysql 8 jdbc:mysql:// serverTimezone=GMT%2B8Set Dongba District Beijing timeThe result server is in GermanyThe code involves the comparison of timestamp conversion, which is 8 hours worse.Therefore, you must modify the time zone when connecting to the MySQL database.