Ashish Karalkar wrote: > Hello all, > I am getting a syntax error near open cursor, > can anybody please point me what is missing. i am > using Postgresql 8.2 > > CREATE OR REPLACE FUNCTION > sp_gen_foreign_keys_tables(OUT par_result integer, OUT > par_childtables text, IN par_colname character varying > , IN par_colvalue integer) AS > $BODY$ > > DECLARE > tablename varchar(300); > columnname varchar(300); > countno integer; > curfroeign cursor (columnname varchar(300)) is select > distinct(fk_relation),fk_column from foreign_keys > where pk_relation in (select pk_relation from > foreign_keys where pk_column=columnname); > var_str1 varchar(300); > > BEGIN > > > open curforeign(par_colname); Postgres doesn't know what curforeign is, it does however know what curfroeign is ;) -- Alban Hertroys alban@xxxxxxxxxxxxxxxxx magproductions b.v. T: ++31(0)534346874 F: ++31(0)534346876 M: I: www.magproductions.nl A: Postbus 416 7500 AK Enschede // Integrate Your World //