У меня есть таблица из 20M записей в Oracle со столбцом datetime (один из столбцов) типа VARCHAR и в часовом поясе EST. Я пытаюсь создать новый столбец, конвертирующий дату и время в эпоху Unix, но он выдает ошибку.
create function unix_timestamp(pi_date date) return number is
c_base_date constant date := to_date('1970-01-01 00:00:00', 'YYYY-MM-DD HH:MM:SS');
c_seconds_in_day constant number := 24 * 60 * 60;
v_unix_timestamp number;
begin
v_unix_timestamp := trunc((pi_date - c_base_date) * c_seconds_in_day);
if (v_unix_timestamp < 0 ) then
raise_application_error(-20000, 'unix_timestamp:: unix_timestamp cannot be nagative');
end if;
return v_unix_timestamp;
end unix_timestamp;
Это функция, которую я создал, и когда я пытаюсь вызвать эту функцию, она выдает сообщение об ошибке:
ORA-01861: literal does not match format string
01861. 00000 - "literal does not match format string"
*Cause: Literals in the input must be the same length as literals in
the format string (with the exception of leading whitespace). If the
"FX" modifier has been toggled on, the literal must match exactly,
with no extra whitespace.
*Action: Correct the format string to match the literal.
Могу ли я получить помощь?