• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Oracle package variables in JDBC.

 
Kumar Shanmugam
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody know how we can use Oracle Package variable in Java/JDBC?

I am using a insert trigger on a table which will initialize the login user
from a package variable.In my log4j configuration file, while inserting data into this table, I am updating the user with my current user. But the insert statement is not identifying the user and it is inserting null.

PLease let me know.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kumar,
A trigger is defined on the database, not through JDBC. So this gets the problem out of the Java sphere.

If you can post the trigger here, maybe someone will see a problem with it.
 
Kumar Shanmugam
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the trigger.

----------------------
create or replace TRIGGER DWUSER.TDS_JAVA_LOG_TRIG
BEFORE INSERT
ON DWADMIN.TDS_JAVA_LOG
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
tmpVar NUMBER;
BEGIN
tmpVar := 0;

:NEW.login_date := systimestamp;
:NEW.user_id := log_user.v_log_user;

END tds_java_log_trig;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic