在Oracle中创建存储过程会抱怨无效变量声明

Man*_*ani 1 oracle plsql stored-procedures

当我尝试创建这样的存储过程时:

create or replace
procedure USR_Trial
( auth out usrr.DEPARTMENT 
)
AS
BEGIN
  select authority_id 
  into auth
  from usrr where user_id='G68EF610';
END USR_Trial;
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Error(2,1): PLS-00488: invalid variable declaration:  object 'USRR.DEPARTMENT' must be a type or subtype

我怎样才能解决这个问题?

Ton*_*ews 6

如果usrr.DEPARTMENT是表中的列,并且您希望OUT参数与该列具有相同的数据类型,则语法为:

create or replace
procedure USR_Trial
( auth out usrr.DEPARTMENT%type 
)
...
Run Code Online (Sandbox Code Playgroud)