--execute和call的区别
-------------------------2014/01/14
EXEC is a sqlplus command that put its argument as an anonymous pl/sql block: 'EXEC xxx' is transformed to 'BEGIN xxx; END;'
So you can use it to call a procedure, or do any pl/sql
It is documented here:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12022.htm#i2697931
CALL is a SQL statement that calls a stored procedure
It is the 'standard' way to call a procedure without doing pl/sql.
For example if you call a procedure from JDBC it uses CALL to call the procedure and return parameters.
It is documented here:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4008.htm#BABDEHHG
Now about v$sql, I can see both:
SQL> call dbms_output.put_line('called');
Call completed.
SQL> select sql_text from v$session join v$mystat using(sid) join v$sql on(v$sql.sql_id=v$session.prev_sql_id)where rownum=1;
SQL_TEXT
------------------------------------------------------------------------------------------------------------------------------------
call dbms_output.put_line('called')
SQL> exec dbms_output.put_line('executed');
PL/SQL procedure successfully completed.
SQL> select sql_text from v$session join v$mystat using(sid) join v$sql on(v$sql.sql_id=v$session.prev_sql_id)where rownum=1;
SQL_TEXT
------------------------------------------------------------------------------------------------------------------------------------
BEGIN dbms_output.put_line('executed'); END;