'PL/SQL: Statement ignored in trigger

I am really confused with PLSQL error messages

The following errors are returned:

Error at line 13: PL/SQL: Statement ignored

1. create or replace TRIGGER trg before insert on pacient for each row
2. declare
3. rr varchar(3);

It told me that I have an error on line 13, but it shows me line 3 :(. Any idea how to orientate in those messages? Thank you.

Here is my code:

 create or replace TRIGGER trg before insert on pacient for each row
 declare
  rr varchar(3);
  mm varchar(3);
  dd varchar(3);
  abc varchar(4);
  x varchar(2);
begin
  rr:=substr (:new.num, 1, 2);
  mm:=substr (:new.num, 3, 2);
  dd:=substr (:new.num, 5, 2);
  abc:=substr (:new.num, 7, 3); 
  x:=substr (:new.num, 10, 1);
  if mod (to_number(rr || mm || dd || abc))<>to_number(x) then raise_application_error(-20500,'wrong    number');
  end if;   
end;


Solution 1:[1]

The MOD function accepts two parameters.

I guess what you want to achieve is this (really just guessing):

  if mod (to_number(rr || mm || dd || abc),to_number(x)) != 0 then  
      raise_application_error(-20500,'wrong    number');
  end if;   

Do you know what MOD does? E.g. MOD(15,6) is 3 and MOD(18,6) is 0.

Maybe you can edit your question and let us know a bit what this all is for.

Solution 2:[2]

One thing I noticed is that Mod needs another parameter. You need to specify what value you want to divide your number by to return the remainder.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aberrant80
Solution 2 gmiley