使用SQL Developer在Oracle中编写存储过程的简单方法是什么?

时间:2016-09-26 19:11:26

标签: sql database oracle oracle-sqldeveloper

以下是程序:

CREATE PROCEDURE show @faculty VARCHAR(20) 
AS
BEGIN
    SELECT * 
    FROM tutor
    WHERE title LIKE @faculty+'%'
END

以下是程序执行:

EXEC show 'FI'

如何为SQL Developer重写此内容?

1 个答案:

答案 0 :(得分:2)

使用Oracle 12 ,您可以执行此操作:

CREATE PROCEDURE show(p_faculty varchar)
AS
  cur SYS_REFCURSOR; 
BEGIN 
  OPEN cur FOR 
    SELECT * 
    FROM tutor
    WHERE title LIKE p_faculty || '%';
  DBMS_SQL.RETURN_RESULT(cur); 
END; 
/  

然后用:

运行它
exec show_x ('FI');