Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2013
    Posts
    46

    Unanswered: how to always store trim() values

    I have a trigger to trim values using trim(:new.value) before inserting but what if one record is updated and by mistake a space is added, i'm sure a update trigger is not recommended as we won't ever know which column was updated. is there a way to always store trim(value) by default? regardless of insert or update..

    thanks in advance.

  2. #2
    Join Date
    Dec 2007
    Posts
    253
    Use an API. By that I mean don't allow anyone direct access to the table for DML, only allow DML via a set of procedures, grant execute on those procedures to whomever needs to perform DML on the table. Within the procedure, you can trim all the values that you see fit prior to the actual insert or update actions.

  3. #3
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by jigmod01 View Post
    as we won't ever know which column was updated.
    Why do you think that?

    http://docs.oracle.com/cd/E11882_01/...s.htm#LNPLS652
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  4. #4
    Join Date
    Sep 2013
    Posts
    46
    Quote Originally Posted by shammat View Post
    Why do you think that?

    PL/SQL Triggers
    Thank you Shammat =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •