text: /*
   *  Add Step Autonomous
   */
  CREATE FUNCTION _autonomous_add_step(p_job_id bigint, p_action text) RETURNS bigint
      LANGUAGE plpgsql
      AS $$
  DECLARE
      v_step_id bigint;
  BEGIN
      SELECT nextval('@extschema@.job_detail_step_id_seq') INTO v_step_id;
  
      INSERT INTO @extschema@.job_detail (job_id, step_id, action, start_time)
      VALUES (p_job_id, v_step_id, p_action, current_timestamp);
  
      RETURN v_step_id;
  END
  $$;
  
  /*
   *  Add Step
   */
  CREATE FUNCTION add_step(p_job_id bigint, p_action text) RETURNS bigint
      LANGUAGE plpgsql
      AS $$
  DECLARE 
      v_step_id bigint;
      v_remote_query text;
      v_dblink_schema text;
      
  BEGIN
  
      SELECT nspname INTO v_dblink_schema FROM pg_namespace n, pg_extension e WHERE e.extname = 'dblink' AND e.extnamespace = n.oid;
      
      v_remote_query := 'SELECT @extschema@._autonomous_add_step (' ||
          p_job_id || ',' ||
          quote_literal(p_action) || ')';
  
      EXECUTE 'SELECT step_id FROM ' || v_dblink_schema || '.dblink('||quote_literal(@extschema@.auth())||
          ','|| quote_literal(v_remote_query) || ',TRUE) t (step_id bigint)' INTO v_step_id;
  
      IF v_step_id IS NULL THEN
          RAISE EXCEPTION 'Job creation failed';
      END IF;
  
      RETURN v_step_id;
  END
  $$;
  