错误(11,1):PLS-00103:遇到符号“DECLARE”

时间:2016-12-02 00:34:54

标签: sql oracle plsql error-handling

CREATE OR REPLACE FUNCTION totalPatients
RETURN number IS
   total number(2) := 0;
BEGIN
   SELECT count(*) into total
   FROM patient;

   RETURN total;
END;

DECLARE
   c number(2);
BEGIN
   c := totalPatients();
   dbms_output.put_line('Total no. of Patients: ' || c);
END;


Error(11,1): PLS-00103: Encountered the symbol "DECLARE"

1 个答案:

答案 0 :(得分:2)

在函数定义之后和匿名块之后,单独添加斜杠{{1}}(在单独的行上)。其他一切都应该有用。