Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Null CLOB value when inserting into table from trigger

WP v.2Sep 6 2018 — edited Sep 8 2018

Hey all,

I have an "after insert or update" trigger on a database table that has a clob column. In the trigger I'm checking to see if the new clob value is different than the old value and if it is, I'm inserting both the new and old value in a separate table which is used for a change log. The comparison works fine and a row is indeed inserted into the change log table. However, the row in the change log table has null for the new clob value, while the old value gets inserted correctly. What is the cause of this and what can I do to insert the new clob value correctly?

The Oracle db version is 12.1.0.2

Thanks,

Bill

Comments

DrClap
Sure, that will work as long as the type in question has an accessible zero-argument constructor. So yes, in your example you could return a new ArrayList or a new HashSet. Not a new ArrayList<Thing>, though, because generics are a compile-time concept only and mean nothing at run time.

By the way it's more traditional to just pass a Class object directly, instead of a wasted object of that class:
public Class<?> method(Class<?> arg) {    
    Class<?> copy = arg.newInstance();
    return copy;
}
And to call that:
ArrayList result = method(ArrayList.class);
843793
@DrClap: shouldn't your method be:
public Object method(Class<?> arg) {    
    Object copy = arg.newInstance();
    return copy;
}
DrClap
Robert.Bossy wrote:
@DrClap: shouldn't your method be:
public Object method(Class<?> arg) {    
Object copy = arg.newInstance();
return copy;
}
Yes, you're right. Or perhaps something like
public T method(Class<? extends T> arg) {    
    T copy = arg.newInstance();
    return copy;
}
Although I have to say, this method doesn't look as useful to me as it apparently did to the OP.
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 6 2018
Added on Sep 6 2018
12 comments
5,677 views