Re: plpgsql function question - Mailing list pgsql-sql

From Karthikeyan Sundaram
Subject Re: plpgsql function question
Date
Msg-id BAY131-W18D3A18906E05E2B1E90CCB0670@phx.gbl
Whole thread Raw
In response to plpgsql function question  (Karthikeyan Sundaram <skarthi98@hotmail.com>)
Responses Re: plpgsql function question  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: plpgsql function question  (John DeSoi <desoi@pgedit.com>)
List pgsql-sql
Hi,<br />  <br />   I guess there is some misunderstanding from my question<br />  <br />   Let me elaborate more
clearly.<br/>  <br />    My Table is <br />  <br />  Create table a (<br />  i int,<br />  j varchar(20),<br />  k
date);<br/>  <br /> Create or replace function a_func (in p_i int, in p_j varchar, in p_k date) returns int as<br />
$$<br/>   ----- do the validation<br />   return 1;<br /> $$<br /> language 'plpgsql';<br />  <br /> This works fine<br
/> <br /> What I want is something like this<br /> create or replace functinon a_func (in a%rowtype) returns int as<br
/>$$<br />    ---- do the validation<br /> $$<br /> language 'plpgsql';<br />  <br /> execute a_func(1,
'good','04/02/2007');<br/>  <br />  <br /><br /><br />> Date: Tue, 3 Apr 2007 20:18:43 +0200<br />> From:
akretschmer@spamfence.net<br/>> To: pgsql-sql@postgresql.org<br />> Subject: Re: [SQL] plpgsql function
question<br/>> <br />> Karthikeyan Sundaram <skarthi98@hotmail.com> schrieb:<br />> <br />> > <br
/>>> Hi,<br />> > <br />> > I am having a requirement here.<br />> > <br />> > 1) I need
towrite a plpgsql function where it takes the input<br />> > parameter of a structure of a table.<br />> <br
/>>Because? To build this table? You can pass an ascii-text with the<br />> table-definition and EXECUTE this
string.<br/>> <br />> <br />> > 2) The table has 15 columns<br />> <br />> Okay. And the problem
is?<br/>> <br />> <br />> > 3) It does lots of validation based on the parameter and finally<br />> >
returnsan integer as output parameters<br />> <br />> Okay. create function ... returns int as $$ ... return 1;
end;$$<br />> language plpgsql;<br />> <br />> <br />> > <br />> > Q) How will I passe the table
structureas as parameter<br />> <br />> As i said, for instance as simple text and EXECUTE this.<br />> <br
/>><br />> > 2) Do I need to create a type?<br />> <br />> No.<br />> <br />> <br />>
Andreas<br/>> -- <br />> Really, I'm not out to destroy Microsoft. That will just be a completely<br />>
unintentionalside effect. (Linus Torvalds)<br />> "If I was god, I would recompile penguin with --enable-fly."
(unknow)<br/>> Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°<br />> <br />>
---------------------------(endof broadcast)---------------------------<br />> TIP 9: In versions below 8.0, the
plannerwill ignore your desire to<br />> choose an index scan if your joining column's datatypes do not<br />>
match<br/><br /><hr />i'm making a difference. Make every IM count for the cause of your choice. <a
href="http://clk.atdmt.com/MSN/go/msnnkwme0080000001msn/direct/01/?href=http://im.live.com/messenger/im/home/?source=wlmailtagline"
target="_new">JoinNow.</a> 

pgsql-sql by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: plpgsql function question
Next
From: Steve Midgley
Date:
Subject: Re: [pgsql-sql] Daily digest v1.2492 (19 messages)