ORA-01722 Error when Returning Identity Column into variable

Viewed 17

I have the table below, and I am inserting a record into it. For some reason, the RETURNING [column_name] INTO [variable] is throwing an ORA-01722: invalid number error. I've looked at other similar issues on stack overflow and elsewhere and only thing I found is someone was using a variable for the [column_name] that needed an extra step, but i'm using the [column_name] explicitly.

TABLE:
    catalog_year
      catalog_year_id    number       (pk, identity column)
      catalog_year       varchar2(10)
      catalog_status_id  number 

declare
  l_new_calendar_year_id  number;

begin
    insert into catalog_year
      (catalog_year, catalog_status_id)
    values
      ('2022-2023', 5)
    returning catalog_year_id into l_new_calendar_year_id;
end;
0 Answers
Related