mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00

dspace/etc to overwrite the originals for the Oracle port to work. The must be kept up to date with any schema changes! git-svn-id: http://scm.dspace.org/svn/repo/trunk@1060 9c30dcfa-912a-0410-8fc2-9e0234be79fd
37 lines
875 B
MySQL
Executable File
37 lines
875 B
MySQL
Executable File
-- #############################################################################################
|
|
--
|
|
-- %Purpose: Set a sequence to the max value of a given attribute
|
|
--
|
|
-- #############################################################################################
|
|
--
|
|
-- Paramters:
|
|
-- 1: sequence name
|
|
-- 2: table name
|
|
-- 3: attribute name
|
|
--
|
|
-- Sample usage:
|
|
-- @updateseq-oracle.sql my_sequence my_table my_attribute
|
|
--
|
|
--------------------------------------------------------------------------------
|
|
--
|
|
SET SERVEROUTPUT ON SIZE 1000000;
|
|
--
|
|
DECLARE
|
|
dummy NUMBER := 0;
|
|
curr NUMBER := 0;
|
|
BEGIN
|
|
--
|
|
--SELECT &1..nextval INTO dummy FROM dual;
|
|
--dbms_output.put('start with next value=' || dummy);
|
|
--
|
|
SELECT max(&3) INTO curr FROM &2;
|
|
|
|
DROP SEQUENCE &1;
|
|
CREATE SEQUENCE &1 START WITH curr;
|
|
|
|
--
|
|
dbms_output.put_line(', end=' || dummy);
|
|
--
|
|
END;
|
|
/
|