Received: from fep43-svc.tin.it ([212.216.176.239]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5CDwbE67914 for ; Tue, 12 Jun 2001 09:58:37 -0400 (EDT) (envelope-from suisani@demetra.com) Received: from andrea ([212.216.39.5]) by fep43-svc.tin.it (InterMail vM.4.01.03.13 201-229-121-113) with SMTP id <20010612135628.CPRV744.fep43-svc.tin.it@andrea> for ; Tue, 12 Jun 2001 15:56:28 +0200 Message-ID: <01c801c0f347$d7863ba0$7501a8c0@andrea> From: "Andrea Suisani" To: Subject: PL/pgsql question Date: Tue, 12 Jun 2001 15:59:03 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Archive-Number: 200106/173 X-Sequence-Number: 3396 hi, i define a function using pgacces with pl/pgsql. it seems that the queries define in the function wasn't executed. if I try to excute the same queries from the psql everything, really, works fine. the body of the function is: ----------------------------------- Declare rec_struttura record; estra_capo float8; estra_non float8; rand_doub float8; row float8; capo int; i int; rand_max float8; Begin i:=0; For rec_struttura in Select * From struttura_campione Loop i:=i+1; prov := rec_struttura.cod_prov; estra_capo := rec_struttura.num_capo; estra_non := rec_struttura.num_non_capo; capo := 1; row:=prova_rand(prov,capo,1)::float8; rand_doub:=(estra_capo/row); if i = 1 then create table tmp as select * from veneto where cod_prov=prov and capoluo=capo and rand < rand_doub and occupato = false limit estra_capo; end if; if i > 1 then insert into tmp select * from veneto where cod_prov=prov and capoluo=capo and rand < rand_doub and occupato = false limit estra_capo ; end if; insert into campione_out select note, prefisso, telefono1 as telefono, cap, cod_com, cod_prov, citta, nome_cogno as nome_cognome, capoluo, estrazione as ultimo_acesso, rand from tmp; insert into tab_estrazioni (prefisso,telefono) select prefisso as presisso, telefono1 as telefono from tmp; delete from tmp; rand_max:=prova_rand(prov,capo,2); update veneto set occupato = true, estrazione = now() where (capoluo = capo and cod_prov = prov) and (rand <= rand_max) and occupato=false ; end loop; return rand_doub; end; -------------------------------------------------------------- no errors are report in log file during the excution of this function. What should i change in the function? Thanks in advance for any advice Andrea P.S. i'm sorry for my bad english