pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
plpgsql function arguments
2+ messages / 1 participants
[nested] [flat]

* plpgsql function arguments
@ 1999-09-29 07:56  Sergey Bondarenko <sbon@scelto.ts.kiev.ua>
  0 siblings, 0 replies; 2+ messages in thread

From: Sergey Bondarenko @ 1999-09-29 07:56 UTC (permalink / raw)
  To: pgsql-sql

Hi!

The documentation on PL/pgSQL reads:

--cut

name class%ROWTYPE;

Declares a row with the structure of the given class. Class must be an existing table- or
viewname of the database. The fields of the row are accessed in the dot notation.
Parameters to a function can be composite types (complete table rows). In that case, the
corresponding identifier $n will be a rowtype, but it must be aliased using the ALIAS
command described below. Only the user attributes of a table row are accessible in the
row, no Oid or other system attributes (hence the row could be from a view and view rows
don't have useful system attributes).

The fields of the rowtype inherit the tables fieldsizes or precision for char() etc. data
types.

---cut

Does someone used as arguments rowtypes? I failed even to create such function.
I have a table called saldo.

create table saldo (
        usename text,
        saldo   float8
);

Then I try to create a function:

create function test ( ?????? ) reaturns int4 as '
        declare
                x alias for $1;
                y saldo%rowtype;
        begin
                return 1;
        end;
' language 'plpgsql';

That's just test function. It does nothing. The question is what should I write instead
of ?????? when I need to feed the function with the rowtype of saldo. I tried
saldo%rowtype. It fails when meet '%'; 

Any advice greatly appreciated.

Sergey Bondarenko
Relcom-Ukraine system administrator




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* plpgsql function arguments
@ 1999-10-02 06:59  Sergey Bondarenko <sbon@scelto.ts.kiev.ua>
  0 siblings, 0 replies; 2+ messages in thread

From: Sergey Bondarenko @ 1999-10-02 06:59 UTC (permalink / raw)
  To: pgsql-sql

Hi!

The documentation on PL/pgSQL reads:

--cut

name class%ROWTYPE;

Declares a row with the structure of the given class. Class must be an existing table- or
viewname of the database. The fields of the row are accessed in the dot notation.
Parameters to a function can be composite types (complete table rows). In that case, the
corresponding identifier $n will be a rowtype, but it must be aliased using the ALIAS
command described below. Only the user attributes of a table row are accessible in the
row, no Oid or other system attributes (hence the row could be from a view and view rows
don't have useful system attributes).

The fields of the rowtype inherit the tables fieldsizes or precision for char() etc. data
types.

---cut

Does someone used as arguments rowtypes? I failed even to create such function.
I have a table called saldo.

create table saldo (
        usename text,
        saldo   float8
);

Then I try to create a function:

create function test ( ?????? ) reaturns int4 as '
        declare
                x alias for $1;
                y saldo%rowtype;
        begin
                return 1;
        end;
' language 'plpgsql';

That's just test function. It does nothing. The question is what should I write instead
of ?????? when I need to feed the function with the rowtype of saldo. I tried
saldo%rowtype. It fails when meet '%'; 

Any advice greatly appreciated.

Sergey Bondarenko
Relcom-Ukraine system administrator



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-10-02 06:59 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-09-29 07:56 plpgsql function arguments Sergey Bondarenko <sbon@scelto.ts.kiev.ua>
1999-10-02 06:59 plpgsql function arguments Sergey Bondarenko <sbon@scelto.ts.kiev.ua>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox