From qtboyzz@yahoo.com Thu Feb 17 02:11:21 2005 X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3BABA8B9B2E for ; Thu, 17 Feb 2005 02:11:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84739-06 for ; Thu, 17 Feb 2005 02:11:13 +0000 (GMT) Received: from web61009.mail.yahoo.com (web61009.mail.yahoo.com [216.155.196.98]) by svr1.postgresql.org (Postfix) with SMTP id 1073D8BA0BB for ; Thu, 17 Feb 2005 02:11:16 +0000 (GMT) Received: (qmail 779 invoked by uid 60001); 17 Feb 2005 02:11:16 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=JYJPVf8u7Eg99hmRd2exg3BCQy+BbxLUN+TUAOnkBsVDDJwrbONBMiOJNquuysny8voRvPg28psn0dcoIEmmr4CBONfBxAVWq4hcdAn0NE0v0jZVpzKoKXjpVn6jBh3AvmXgJ8JTapQ9OI1j1/G64MQw0z5QLJB+u1CzXNNABB4= ; Message-ID: <20050217021116.777.qmail@web61009.mail.yahoo.com> Received: from [68.120.230.43] by web61009.mail.yahoo.com via HTTP; Wed, 16 Feb 2005 18:11:16 PST Date: Wed, 16 Feb 2005 18:11:16 -0800 (PST) From: b t Subject: Question Regarding Procedural Function (store procedure) To: pgsql-interfaces@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-200546538-1108606276=:99548" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.812 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_10_20, HTML_MESSAGE, RCVD_IN_NJABL_PROXY X-Spam-Level: * X-Archive-Number: 200502/62 X-Sequence-Number: 5307 --0-200546538-1108606276=:99548 Content-Type: text/plain; charset=us-ascii Hi, first of all thanks for taking the time to read my message. I'm new to Sql and is very confuse of how to write a procedural function. I want to write a function that check if the data is aready in the table then it should not add to the table instead of linking it to the table. This is what I mean, I have a movies table and a stars table and a stars_in_movies (this table keep track of the stars in what movies). So I'm suppose to write a store procedure that add the movie to the database, if there is a star in the new movies then is already exist in the stars table then it should link that star to the new movie. thanks in advance -brian --------------------------------- Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. Learn more. --0-200546538-1108606276=:99548 Content-Type: text/html; charset=us-ascii
Hi, first of all thanks for taking the time to read my message. I'm new to Sql and is very confuse of how to write a procedural function. I want to write a function that check if the data is aready in the table then it should not add to the table instead of linking it to the table. This is what I mean, I have a movies table and a stars table and a stars_in_movies (this table keep track of the stars in what movies). So I'm suppose to write a store procedure that add the movie to the database, if there is a star in the new movies then is already exist in the stars table then it should link that star to the new movie.
thanks in advance
-brian


Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search. Learn more. --0-200546538-1108606276=:99548-- From bruno@wolff.to Thu Feb 17 16:48:41 2005 X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 481728B9F37 for ; Thu, 17 Feb 2005 16:48:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69647-05 for ; Thu, 17 Feb 2005 16:48:39 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id BC36E8B9F2F for ; Thu, 17 Feb 2005 16:48:39 +0000 (GMT) Received: (qmail 24942 invoked by uid 500); 17 Feb 2005 17:03:46 -0000 Date: Thu, 17 Feb 2005 11:03:46 -0600 From: Bruno Wolff III To: b t Cc: pgsql-interfaces@postgresql.org Subject: Re: Question Regarding Procedural Function (store procedure) Message-ID: <20050217170346.GA24814@wolff.to> Mail-Followup-To: b t , pgsql-interfaces@postgresql.org References: <20050217021116.777.qmail@web61009.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050217021116.777.qmail@web61009.mail.yahoo.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/63 X-Sequence-Number: 5308 On Wed, Feb 16, 2005 at 18:11:16 -0800, b t wrote: > Hi, first of all thanks for taking the time to read my message. I'm new to Sql and is very confuse of how to write a procedural function. I want to write a function that check if the data is aready in the table then it should not add to the table instead of linking it to the table. This is what I mean, I have a movies table and a stars table and a stars_in_movies (this table keep track of the stars in what movies). So I'm suppose to write a store procedure that add the movie to the database, if there is a star in the new movies then is already exist in the stars table then it should link that star to the new movie. You probably want to do this on the application side. While the screen actors guild does things to keep actors names unique, they aren't always used constistantly and occasionally change names. So a database procedure is not in a good position to know whether or not an entry is new. An application could do a check and provide information back to the person entering the data and ask if the person is new. And then create a new entry or modify an existing entry as desired.