pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karthikeyan Sundaram <skarthi98@hotmail.com>
To: Andreas Kretschmer <akretschmer@spamfence.net>
To: pgsql-sql@postgresql.org
Subject: Re: plpgsql function question
Date: Tue, 3 Apr 2007 11:33:39 -0700
Message-ID: <BAY131-W18D3A18906E05E2B1E90CCB0670@phx.gbl> (raw)


Hi,
 
  I guess there is some misunderstanding from my question
 
  Let me elaborate more clearly.
 
   My Table is 
 
 Create table a (
 i int,
 j varchar(20),
 k date);
 
Create or replace function a_func (in p_i int, in p_j varchar, in p_k date) returns int as
$$
  ----- do the validation
  return 1;
$$
language 'plpgsql';
 
This works fine
 
What I want is something like this
create or replace functinon a_func (in a%rowtype) returns int as
$$
   ---- do the validation
$$
language 'plpgsql';
 
execute a_func(1, 'good','04/02/2007');
 
 > Date: Tue, 3 Apr 2007 20:18:43 +0200> From: akretschmer@spamfence.net> To: pgsql-sql@postgresql.org> Subject: Re: [SQL] plpgsql function question> > Karthikeyan Sundaram <skarthi98@hotmail.com> 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 with the> table-definition and EXECUTE this string.> > > > 2) The table has 15 columns> > Okay. And the problem is?> > > > 3) It does lots of validation based on the parameter and finally> > returns an integer as output parameters> > Okay. create function ... returns int as $$ ... return 1; end; $$> language plpgsql;> > > > > > Q) How will I passe the table structure as as parameter> > As i said, for instance as simple text and EXECUTE this.> > > > 2) Do I need to create a type?> > No.> > > Andreas> -- > Really, I'm not out to destroy Microsoft. That will just be a completely> unintentional side effect. (Linus Torvalds)> "If I was god, I would recompile penguin with --enable-fly." (unknow)> Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°> > ---------------------------(end of broadcast)---------------------------> TIP 9: In versions below 8.0, the planner will ignore your desire to> choose an index scan if your joining column's datatypes do not> match
_________________________________________________________________
i'm making a difference. Make every IM count for the cause of your choice. Join Now.
http://clk.atdmt.com/MSN/go/msnnkwme0080000001msn/direct/01/?href=http://im.live.com/messenger/im/ho...

view thread (7+ messages)  latest in thread

Message-ID: <BAY131-W18D3A18906E05E2B1E90CCB0670@phx.gbl>
Permalink:  ../BAY131-W18D3A18906E05E2B1E90CCB0670@phx.gbl/
Also on:    postgresql.org/message-id/BAY131-W18D3A18906E05E2B1E90CCB0670@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: skarthi98@hotmail.com, akretschmer@spamfence.net
  Subject: Re: plpgsql function question
  In-Reply-To: <BAY131-W18D3A18906E05E2B1E90CCB0670@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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