0

我在这里看到了同样的问题Create a Sequence with START WITH from Query但它不起作用。它有 12 票赞成,所以我不确定为什么它对我不起作用。

这就是我所拥有的:

declare
    l_new_seq INTEGER;
begin
   select max(expense_detailid) + 1
   into   l_new_seq
   from   expense_detail;

   execute immediate 'create sequence expense_detail_seq 
                      start with ' || l_new_seq || ' increment by 1';
end;
/

这是我得到的错误:

ORA-06550: line 3, column 17:
PLS-00103: Encountered the symbol "create sequence expense_detail_seq start with " when expecting one of the following:

   := . ( @ % ;
The symbol ":=" was substituted for "create sequence expense_detail_seq start with " to continue. (DBD ERROR: error possibly near <*> indicator at char 27 in '
    BEGIN
      immediate <*>'create sequence expense_detail_seq start with ' || l_new_seq || ' increment by 1';
    END;
  ')

ORA-00900: invalid SQL statement

有任何想法吗?谢谢!

4

1 回答 1

1

将所有文本放在一行中。或者至少每个文字。

另外,产品/实用程序和产品版本是什么?

于 2013-08-28T18:26:40.127 回答