문제

I'm trying to create this function using Toad, but I keep getting an error.

CREATE OR REPLACE FUNCTION minimum (v1 number, v2 number)
RETURN number IS

BEGIN
    IF v1 < v2 THEN
        RETURN v1;
    ELSE
        RETURN v2;
    END IF ;
    SHOW ERRORS;
END;

SELECT minimum(1, 2)
FROM dual;

The error I get is this, but I can't understand what is my mistake.

Warning: Function created with compilation errors
도움이 되었습니까?

해결책

Remove the line:

  SHOW ERRORS;

When compiling in Toad, you do not need to add "show errors" as toad will show you the errors in the error window.

다른 팁

SHOW ERRORS; is a SQL*PLUS command. You cannot use it in a stored procedure you need to remove it and then your procedure will be successfully compiled.

CREATE OR REPLACE FUNCTION minimum (v1 number, v2 number)
RETURN number IS
BEGIN
  IF v1 < v2 THEN
     RETURN v1;
  ELSE
     RETURN v2;
  END IF ;
END;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top