connormcd / audit_utility

Automatic generator for the typical audit triggers we have on Oracle tables with lots of options
51 stars 19 forks source link

Does not properly generate show_history procedure for timestamp with local time zone datatype #10

Closed akluev closed 1 year ago

akluev commented 1 year ago

please take a look at p_created_on and p_updated_on lines:

function show_history(
     p_aud$tstamp_from  timestamp default localtimestamp - numtodsinterval(7,'DAY')
    ,p_aud$tstamp_to    timestamp default localtimestamp
    ,p_aud$id           number    default null
    ,p_aud$image        varchar2  default null
    ,p_config_variable_id  number                     default null
    ,p_variable_scope      varchar2                   default null
    ,p_application_id      number                     default null
    ,p_variable_key        varchar2                   default null
    ,p_variable_value      varchar2                   default null
    ,p_standby_needed      varchar2                   default null
    ,p_standby_value       varchar2                   default null
    ,p_description         varchar2                   default null
    ,p_row_version         number                     default null
    ,p_created_by          varchar2                   default null
    ,p_created_by_id       varchar2                   default null
    ,p_created_on          timestamp with local time   default null
    ,p_updated_by          varchar2                   default null
    ,p_updated_by_id       varchar2                   default null
    ,p_updated_on          timestamp with local time  default null
    ,p_variable_type       varchar2                   default null
  ) return clob;
end;
akluev commented 1 year ago

Looks like 26 here is a problem

         bld('    ,p_'||rpad(substr(lower(cols(i).column_name),1,110),cols(i).maxlen+2)||''||rpad(lower(regexp_replace(cols(i).data_type,'\(.*\)')),26)||' default null');

because

LENGTH('TIMESTAMPWITHLOCALTIMEZONE')
------------------------------------
                                  30