Search code examples
oracle-databaseplsqloracle-apexoracle-apex-5

Error when trying to create procedure, why do you think that is?


all.

I've tried creating a procedure in Oracle Apex 5. However, I get this issue 'ORA-24344: success with compilation error'. I assume it's a syntax error. What do you think it is? *generate_password is a working function that produces a random hex value/string.

CREATE OR REPLACE PROCEDURE add_user (firstname in varchar2(20), lastname in varchar2(20), email in varchar2(100), area in varchar2(50), privileges in varchar2(2))
AS
e varchar2(100);
BEGIN

e := generate_password;

insert into user_login (user_name, first_name, last_name, creation_date, last_update_date,  user_privileges, user_pwd)

values ( email, firstname, lastname, SYSDATE, SYSDATE, privileges , e); 

END add_user;

Solution

  • Don't define the length of the varchar2 parameters of the procedure. Simply write VARCHAR2 without size.

    This is the syntax of PL/SQL. If you think about it, it makes much more sense than defining the length of a buffer that is anyway inherited from the calling code.