0
従業員の有効期限がhire_dateの1年後と定義されているとします。私は、このようなタスクを実行しようとしている機能作成しました:各雇用主の有効期限を選択する
create or replace expiredate(empno in number) return date is
hiredate employees.hire_date%type;
begin
select add_months(e.hire_date,12) into hiredate
from employees e
where empno is not null;
return hiredate;
end expiredate;
をしかし、それは多くのエラーを示し、次のように:
Error starting at line 1 in command:
create or replace expiredate(empno in number) return date is
hiredate employees.hire_date%type
Error at Command Line:1 Column:23
Error report:
SQL Error: ORA-00922: missing or invalid option
00922. 00000 - "missing or invalid option"
*Cause:
*Action:
Error starting at line 3 in command:
begin
select add_months(e.hire_date,12) into hiredate
from employees e
where empno is not null;
return hiredate;
end expiredate;
Error report:
ORA-06550: line 4, column 7:
PL/SQL: ORA-00904: "EMPNO": invalid identifier
ORA-06550: line 2, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 5, column 1:
PLS-00372: In a procedure, RETURN statement cannot contain an expression
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
私は、エラーの主なアイデアがあまりにも多くの行の間違いだと思いますが、どうすればこのコードを修正できますか?
を私は、残念ながら感謝の機能を忘れてしまっている@Mat –