Friday, December 23, 2011

Dbms_xmlgen Convert Error

When running through a large amount of data stored in clobs, I was doing
    DBMS_XMLGEN.CONVERT(DBMS_LOB.SUBSTR(lobcolumn,4000,1))
to first truncate my clob and make it into a varchar, then convert xml/html entities to regular characters.  This was throwing
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
when I got to a value which was actually more than 4000 characters long.  I didn't realize that xmlgen.convert can work on lobs though, so just reversing the order of operations resolved the error:
    DBMS_LOB.SUBSTR(DBMS_XMLGEN.CONVERT(lobcolumn),4000,1)
and it's good to go.

Wednesday, December 21, 2011

Tax Credit Idea

A credit for parents who take a class about how to discipline kids might help reduce child abuse.

Thursday, December 15, 2011

JSR 303 Validation Question

I don't know if anybody has asked this before, but I can't find it on google.  I have a class with two fields (username,email) and need to validate that the email starts with the username.  Can I do something like this?

private String username;
@Pattern(regex="^${username}.*$")

I'm guessing not.