Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    1

    Question Unanswered: update column according to another column value

    hi all;

    I have the following issue:

    a table contains 2 column a value of one of them depend on the value of another column in the same table.

    this is the code of copying this value through form desined for insert:

    declare
    l number(8);
    begin
    l :=length( : products.pr_code);
    if l=3 then
    : products.pr_code2 := lpad( : products.pr_code,4,'0');
    elsif l=5 then
    : products.pr_code2 := lpad( : products.pr_code,6,'0');
    elsif l=7 then
    : products.pr_code2 := lpad( : products.pr_code,8,'0');
    else
    : products.pr_code2 := : products.pr_code;
    end if;
    end;

    I don't know exactly where to write this code (which trigger)
    I tryed post_change trigger on text_item ( : products.pr_code) but when I insert a new row and I click on save I get error UNABLE TO INSERT
    Last edited by emadi; 11-04-04 at 05:54.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    POST-CHANGE is deprecated in favour of WHEN-VALIDATE-ITEM, but there is nothing obviously wrong with your code. Check the actual ORA error message using Display Error.

  3. #3
    Join Date
    Oct 2004
    Posts
    145
    Why are you doing this through forms trigger?

    If the rule is consistent for all records, implemented as row lever trigger on the table.

Posting Permissions

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