Files
DSpace/dspace/etc/oracle/updateseq.sql
David Stuve c13f24e570 Oracle port. These files are meant to be copied to the parent directory
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
2004-09-13 04:36:42 +00:00

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;
/