Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [NOVICE] numericOnly trigger

From: Sean Davis <sdavis2(at)mail.nih.gov>
Date: Fri Sep 21 2007 - 13:31:27 EDT


Derrick Betts wrote:
> I was wondering if anyone has built a trigger or etc. that verifies the
> validity of an entry that is being posted to the database. I would like
> to do the following:
> 1. Iterate through the column types in the table being updated
> 2. If the column type is numeric or real, or etc.,
> a. remove all the strings from the New.value
> b. set the New.value to the newly stripped value
> 3. Update the table with the modified values.
>
> The part I was hoping not to have to reproduce, if anyone has it and is
> willing to share it, is the logic for iterating through the column types
> and cleaning the specific values for update.

I might be wrong, but I do not think your trigger will not actually fire if you try to do an update with text data in a column with a numeric datatype. The type checking happens BEFORE a trigger fires, so you will simply get an error.

Sean

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend Received on Fri Sep 21 13:34:23 2007

This archive was generated by hypermail 2.1.8 : Mon Oct 08 2007 - 17:49:41 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library