ALTER in procedure

Radovan Bičiště radovan.biciste at ceosdata.com
Tue Jul 23 09:50:39 CEST 2013


Hello,
This is my first post here. I tried to search the archive but did not 
find anything related.
We build application and would like disable foreign keys in a procedure. 
Something like:

CREATE PROCEDURE crmkartaaktivita_drop_cons()
BEGIN
   -- hlavička procedury
   DECLARE v_proc VARCHAR(250);
   SET v_proc = 'crmkartaaktivita_drop_cons';
   -- drop
   ALTER TABLE crmkartastitek DROP CONSTRAINT 
crmkartastitek_crmkartaaktivita_FK;
   ALTER TABLE crmkartastitekm DROP CONSTRAINT 
crmkartastitekm_crmkartaakitvita_FK;
END;
/

I'm getting "Statement 'ALTER_TABLE' is not a valid flow control statement".

Is there any way around please?
Our algorithm should like this:
1. disable/drop foreign keys.
2. load data.
3. enable/create constraints.

Thanks,
Radovan
--
Radovan Biciste
Czech Republic



More information about the users-list mailing list