Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by hub.org (8.10.1/8.10.1) with ESMTP id e9G0dnR81623 for ; Sun, 15 Oct 2000 20:39:49 -0400 (EDT) Received: from [63.195.55.98] (HELO agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.3) with ESMTP id 1100142 for pgsql-sql@postgresql.org; Sun, 15 Oct 2000 17:39:48 -0700 Message-ID: <39EA4E56.CAD35C88@agliodbs.com> Date: Sun, 15 Oct 2000 17:39:50 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions X-Mailer: Mozilla 4.73 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: sqllist Subject: Re: Variable-length Types References: <871yxi432t.fsf@matt.w80.math-hat.com> <39E9F80C.D9BE2054@agliodbs.com> <5470.971641584@sss.pgh.pa.us> <39EA154F.A5D9C9A2@agliodbs.com> <39EA1F05.nailA91QW5LV@ed.ed> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200010/137 X-Sequence-Number: 1799 KuroiNeko, > I remember from the old days of Delphi/InterBase, and even older days of > Paradox, there were so called input masks, US phone code mask would be like Input masks still exist for some languages (VB, Paradox) but I've found that even in those platforms that support them I tend to replace them with custom functions, because actually using them is too buggy. > I'm just not sure what to do if 8 or 9 digits are supplied? Maybe, reject, > assuming that such things should be caught by UI, and if we get such a > weird thing, there's something really really wrong? Or, if you're using an interface that doesn't readily support entry validation (e.g. PHP) then you can nest functions and have the "Save" button test for a reply indicating that something's wrong. To wit: Create Function save_candidate (Lots of candidate data variables) RETURNS VARCHAR (100) AS Declare output_string VARCHAR(100) Do a whole bunch of stuff SELECT first_phone = phoneformat(first_phone) IF first_phone = 'fail' ( SELECT output_string = 'Bad phone number for Primary Phone' RETURN output_string ) More code -Josh -- ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 436-9166 for law firms, small businesses fax 436-0137 and non-profit organizations. pager 338-4078 San Francisco