Reputation: 285
I tried to create this function in Oracle Apex 5, SQL Commands and it resulted in this error 'ORA-24344: success with compilation error.' Why do you think so? I'm trying to create a random generated code.
CREATE OR REPLACE FUNCTION generate_code()
return varchar2
AS
code varchar2;
BEGIN
code := DBMS_RANDOM.value(1,100);
return code;
END;
Upvotes: 0
Views: 789
Reputation: 2615
error in syntax, see below
the correct syntax is
CREATE OR REPLACE FUNCTION generate_code
return varchar2
AS
code varchar2(100);
BEGIN
code := DBMS_RANDOM.value(1,100);
return code;
END;
original syntax with error description:
SQL> CREATE OR REPLACE FUNCTION generate_code()
2
3 return varchar2
4 AS
5 code varchar2;
6 BEGIN
7 code := DBMS_RANDOM.value(1,100);
8 return code;
9 END;
10
11 /
Warning: Function created with compilation errors.
SQL> show error
Errors for FUNCTION GENERATE_CODE:
LINE/COL ERROR
-------- -----------------------------------------------------------------
1/24 PLS-00103: Encountered the symbol ")" when expecting one of the
following:
<an identifier> <a double-quoted delimited-identifier>
current delete exists prior
Upvotes: 1