Below is the code for the procedure and trigger along with the error message. It's probably something simple but I'm just not seeing it. The procedure does works outside the job.
CREATE OR REPLACE PROCEDURE P_Execute_Sql
(i_sql IN VARCHAR2)
AS
BEGIN
EXECUTE IMMEDIATE (i_sql);
END;
CREATE OR REPLACE TRIGGER ddl_create
AFTER CREATE ON SCHEMA
DECLARE
g_job BINARY_INTEGER;
g_sql VARCHAR2(4000);
g_object_name user_objects.object_name%TYPE;
g_object_type user_objects.object_type%TYPE;
BEGIN
SELECT
object_name,
object_type
INTO
g_object_name,
g_object_type
FROM
user_objects
WHERE created = (SELECT MAX(created)
FROM user_objects);
IF g_object_type IN ('TABLE','VIEW','FUNCTION','PACKAGE','PROCEDURE','SEQUENCE') THEN
g_sql := 'create or replace public synonym ' || g_object_name || ' for ' || USER || '.' || g_object_name;
DBMS_JOB.SUBMIT (
job => g_job,
what => 'p_execute_sql ("' || g_sql || '");');
END IF;
END;
Error message after creating object:
ORA-06550: line 1, column 108:
PLS-00114: identifier 'create or replace public synon' too long
ORA-06512: at "SYS.DBMS_JOB", line 79
ORA-06512: at "SYS.DBMS_JOB", line 136
ORA-06512: at line 21