Detailed explanation and difference between Oracle call and Exec

Time:2020-7-7

The difference between call and exec in Oracle

Today, I used Oracle to do the project. I found it interesting in the process of doing the project. I found some information and shared it with you

In sqlplus:

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

Summary:

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 
Connected. 
[email protected]> 
[email protected]> create procedure p_test is 
 begin 
 null; 
 end; 
 / 
Procedure created. 
[email protected]> 
[email protected]> exec p_test 
PL / SQL procedure completed successfully. 
[email protected]> call p_test 
 ; 
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

Thank you for reading, thank you for the support of this site, hope to be useful to the people in need