studb_schema_install

studb_schema_install - -- Copyright 2010 Richard Meyer. All...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: -- Copyright 2010 Richard Meyer. All rights reserved. -- This material may not be reproduced, displayed, modified or distributed without the express prior written permissions of the copyright holder. SET SERVEROUTPUT ON SIZE UNLIMITED; BEGIN dbms_output.put_line('Installing Student Database for ISAM 5331 / ACCT 5333' ); dbms_output.put_line('Data Set Version: Spring 2010' ); dbms_output.put_line('Installing as user: ' || USER); dbms_output.put_line('Session ID: ' || USERENV('SESSIONID')); dbms_output.put_line('Installation date: ' || TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')); END; / BEGIN FOR rec IN (SELECT table_name, constraint_name FROM user_constraints WHERE table_name IN ('GRADE', 'STUDENT', 'MAJ_ADV', 'MAJOR', 'ADVISOR', 'SCHOOL') OR r_owner IN ('SCHOOL', 'MAJOR', 'STUDENT', 'GRADE', 'MAJ_ADV', 'ADVISOR') ) LOOP BEGIN DBMS_OUTPUT.put_line('ALTER TABLE ' || rec.table_name || ' ' || 'DISABLE CONSTRAINT ' || rec.constraint_name || ' CASCADE'); EXECUTE IMMEDIATE 'ALTER TABLE ' || rec.table_name || ' ' || 'DISABLE CONSTRAINT ' || rec.constraint_name || ' CASCADE'; DBMS_OUTPUT.put_line( 'ALTER TABLE ' || rec.table_name || ' ' || 'DROP CONSTRAINT ' || rec.constraint_name); EXECUTE IMMEDIATE 'ALTER TABLE ' || rec.table_name || ' ' || 'DROP CONSTRAINT ' || rec.constraint_name; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line (SQLERRM); END; END LOOP; END; / DROP TABLE grade / DROP TABLE student / DROP TABLE maj_adv / DROP TABLE major / DROP TABLE advisor / DROP TABLE school / CREATE TABLE school ( sch_code VARCHAR2(8) CONSTRAINT school_sch_code_pk PRIMARY KEY, sch_name VARCHAR2(50), sch_phone VARCHAR2(12), sch_dean VARCHAR2(20)...
View Full Document

This note was uploaded on 10/09/2010 for the course MIS 5339 taught by Professor Gercek,g during the Spring '10 term at UH Clear Lake.

Page1 / 36

studb_schema_install - -- Copyright 2010 Richard Meyer. All...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online