I'm finding some problems in execution of java triggers (stored procedures). The scripts follow:
create table a (
b number(5),
c varchar2(10)
);
create or replace procedure d (e in out varchar2)
as language java
name 'TriggerOracle.atribuiValor(java.lang.String[])';
/
create or replace trigger f
before insert on a
for each row
call d new.c)
/
*** TriggerOracle.java ***
public class TriggerOracle
{
public static void atribuiValor (String[] variavel)
{
variavel[0] = "xxxx";
}
}
When I try to insert a record in the table A, the size of the string that I use for field C in the insert is used, and not the size of the String defined by the trigger. So:
SQL> insert into a values (1,'aa');
SQL> insert into a values (2,'bbbb');
SQL> insert into a values (3,'cccccc');
SQL> select * from a;
B C
---------- ----------
1 xx
2 xxxx
3 xxxxcc
Is this correct? What is necessary for assign the value "xxxx" (in this case) to the field C?
Thanks,
Jonatan Schroeder
Medisoft - Brazil
create table a (
b number(5),
c varchar2(10)
);
create or replace procedure d (e in out varchar2)
as language java
name 'TriggerOracle.atribuiValor(java.lang.String[])';
/
create or replace trigger f
before insert on a
for each row
call d new.c)
/
*** TriggerOracle.java ***
public class TriggerOracle
{
public static void atribuiValor (String[] variavel)
{
variavel[0] = "xxxx";
}
}
When I try to insert a record in the table A, the size of the string that I use for field C in the insert is used, and not the size of the String defined by the trigger. So:
SQL> insert into a values (1,'aa');
SQL> insert into a values (2,'bbbb');
SQL> insert into a values (3,'cccccc');
SQL> select * from a;
B C
---------- ----------
1 xx
2 xxxx
3 xxxxcc
Is this correct? What is necessary for assign the value "xxxx" (in this case) to the field C?
Thanks,
Jonatan Schroeder
Medisoft - Brazil