Skip site navigation (1) Skip section navigation (2)

how do the pro's do this? (still a newbie)

From: Gunnar Lindholm <gunnar(at)gunix(dot)mine(dot)nu>
To: pgsql-general(at)postgresql(dot)org
Subject: how do the pro's do this? (still a newbie)
Date: 2001-10-30 12:11:39
Message-ID: 01103013113901.00334@fire (view raw or flat)
Thread:
Lists: pgsql-general
Hello.
As a newbie in the stored procedure programming area I would like to know how 
you could do the following with a function in plpgsql.
(It's a theoretical question, so do not suggest changing the tables :-)
I have 

 table A :
	id 	integer primary key default nextval('something'),
	dohA	integer

table B:
	rid	integer references A,
	dohB	integer

and I wish to create a function "foo( dohA, dohB)" that inserts the values 
dohA and dohB into the proper tables A and B and the reference in table B 
should of course be connected to the PK in table A. You understand what I 
mean, right?

Now, how do I write

   function foo(integer, integer)
      begin work
      ... please fill this space with some code.... !!!!
      commit
   
Is there some realy good tutorial on this, please tell me so?
TIA, Gunnar.

Responses

pgsql-general by date

Next:From: Tille, AndreasDate: 2001-10-30 12:17:18
Subject: Re: [HACKERS] Serious performance problem
Previous:From: Jean-Michel POUREDate: 2001-10-30 12:10:18
Subject: Re: [HACKERS] Serious performance problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group