If you use a plpgsql function to select the row you want to validate,
it will make life much easier. Something like
...
$$
declare
my_row a_row_type;
is_ok integer;
begin
select into my_row * from a_row_type where
is_ok := my_a_validate(my_row);
return is_ok;
$$
...
On Apr 4, 20
am Tue, dem 03.04.2007, um 13:19:26 -0700 mailte Karthikeyan Sundaram
folgendes:
> Thank you very much. It works. I am not doing any insert or update hence I
> cannot create a trigger. But my another question is
>
> How will I pass the values to Foo parameters.
>
> I mean
>
> I want to p
It should work pretty much like you have it. You don't need a type;
the table is already a type.
Something like:
create or replace function a_func (in p_row a) returns int as
$$
if p_row.i ...
if p_row.j ...
$$
If it does not work, show the error and I'll try to dig up an example.
John
the
table-structure. Than you can create your function.
test=# create type a as ( i int, j varchar(20), k date);
CREATE TYPE
test=*# create function my_a (IN foo a) returns int as $$begin return 1; end;
$$ language plpgsql;
CREATE FUNCTION
test=*#
> > Date: Tue, 3 Apr 2007 20:18:43 +0200
Date: Tue, 3 Apr 2007 20:18:43 +0200> From: [EMAIL PROTECTED]> To:
> pgsql-sql@postgresql.org> Subject: Re: [SQL] plpgsql function question> >
> Karthikeyan Sundaram <[EMAIL PROTECTED]> schrieb:> > > > > Hi,> > > > I am
> having a requireme
Karthikeyan Sundaram <[EMAIL PROTECTED]> schrieb:
>
> Hi,
>
> I am having a requirement here.
>
> 1) I need to write a plpgsql function where it takes the input
> parameter of a structure of a table.
Because? To build this table? You can pass an ascii-text
Hi,
I am having a requirement here.
1) I need to write a plpgsql function where it takes the input parameter of
a structure of a table.
2) The table has 15 columns
3) It does lots of validation based on the parameter and finally returns an
integer as output parameters
Q) Ho