From: | Roberto Rezende de Assis <rezende_assis(at)yahoo(dot)com(dot)br> |
---|---|
To: | Postgesql list <pgsql-novice(at)postgresql(dot)org> |
Subject: | Why this does not work ?? |
Date: | 2004-07-03 18:22:36 |
Message-ID: | 40E6F96C.8000307@yahoo.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hello all, why this does not work ?
-----------------------------------------
create table original(num int);
-----------------------------------------
create table copia(num int);
-----------------------------------------
insert into original(num) values (1);
insert into original(num) values (2);
insert into original(num) values (3);
-----------------------------------------
create function copiar()
returns int as '
declare
ponteiro int;
begin
for ponteiro in select * from original order by num asc loop
insert into copia(num) values(ponteiro);
end loop;
return 1;
end;
' language plpgsql;
-----------------------------------------
-----------------------------------------
-----------------------------------------
This are the results
teste=# \i for.sql
CREATE TABLE
CREATE TABLE
INSERT 127676 1
INSERT 127677 1
INSERT 127678 1
CREATE FUNCTION
teste=# select copiar();
WARNING: plpgsql: ERROR during compile of copiar near line 4
ERROR: missing .. at end of SQL expression
teste=#
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Rezende de Assis | 2004-07-03 19:08:29 | Re: Why this does not work ?? (Now it has worked) |
Previous Message | R.Welz | 2004-07-03 17:05:40 | Re: createlang doesn't work |