ALTER in procedure

Stefan Manegold Stefan.Manegold at cwi.nl
Tue Jul 23 09:55:11 CEST 2013


Hi Radovan,

I'm afraid that MonetDB does not allow any schema manipulation with SQL procedures (or functions).
I'm actually not sure, whether the SQL standard allows that ...

Having said that, why would you want to drop constraints while loading data, only to add them afterwards, again?

Best,
Stefan

----- Original Message -----
> 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
> _______________________________________________
> users-list mailing list
> users-list at monetdb.org
> http://mail.monetdb.org/mailman/listinfo/users-list
> 

-- 
| Stefan.Manegold at CWI.nl | DB Architectures   (DA) |
| www.CWI.nl/~manegold/  | Science Park 123 (L321) |
| +31 (0)20 592-4212     | 1098 XG Amsterdam  (NL) |




More information about the users-list mailing list