From: | José Soares <jose(at)sferacarta(dot)com> |
---|---|
To: | abdelkrim <haj(at)idianet(dot)net> |
Cc: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: [GENERAL] insert into view !! |
Date: | 1999-06-24 13:00:36 |
Message-ID: | 37722BF4.E6289592@sferacarta.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Try this script:
create table emp (
empno int,
ename char(10),
jobchar(12),
hiredate date,
saldecimal(10,2),
commint,
deptno int,
nivel int,
mgrint
);
create view vista
as select empno, ename, job
from emp
where job='SALESMAN';
create function view_upd() returns opaque as '
begin
if tg_op = ''INSERT'' then
if new.job = ''SALESMAN'' then
INSERT INTO emp VALUES (new.empno,new.ename,new.job);
return new;
else
raise notice ''impossible to add records where JOB is
not "SALES
return null;
end if;
end if;
end;
' language 'plpgsql';
create trigger t_add before insert
on vista for each row execute procedure view_upd();
abdelkrim ha scritto:
> it is possible to insert into a view ?
>
> thanks
--
______________________________________________________________
PostgreSQL 6.5.0 on i586-pc-linux-gnu, compiled by gcc 2.7.2.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jose'
From | Date | Subject | |
---|---|---|---|
Next Message | José Soares | 1999-06-24 13:14:07 | Re: [GENERAL] Datetime <> ODBC <> Access |
Previous Message | Karin Probost | 1999-06-24 12:44:44 | Re: [GENERAL] unique fields |