PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/hippo-migrate/do/00009-do_CreateTreatments.sql

http://hdbc.googlecode.com/
SQL | 26 lines | 21 code | 3 blank | 2 comment | 0 complexity | 66e28ba14124deaac7ffa5d191021310 MD5 | raw file
 1VARIABLE v_pk  NUMBER;
 2
 3BEGIN
 4    hippo.sp_log_version_change_begin('00009-do_CreateTreatments.sql', &1, :v_pk);
 5END;
 6/
 7
 8---- ddl below ------------------------------------------
 9CREATE TABLE hippo.treatments (
10	user_cd 		number,
11	experiment_cd 	number,
12	treatment		XMLType NOT NULL,
13	CONSTRAINT pk_treatments PRIMARY KEY (user_cd, experiment_cd),
14	CONSTRAINT fk_trtmnts_to_users FOREIGN KEY (user_cd) REFERENCES hippo.users,
15	CONSTRAINT fk_trtmnts_to_exprmnts FOREIGN KEY (experiment_cd) REFERENCES hippo.experiments
16);
17---------------------------------------------------------
18
19BEGIN
20    hippo.sp_update_version(9);
21    hippo.sp_log_version_change_finish(:v_pk, 'success');
22EXCEPTION
23    WHEN OTHERS THEN
24        hippo.sp_log_version_change_finish(:v_pk, 'fail');
25END;
26/