Domanda

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
È stato utile?

Soluzione

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.

Altri suggerimenti

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;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top