Re: Error with Clob
Fred Toussi <[email protected]>
| Newsgroups | gmane.comp.java.hsqldb.user |
|---|---|
| Message-ID | <1363903946.29686.140661207525921.637A6014@webmail.messagingengine.com> |
Yes, it looks right. You cannot pass a CLOB parameter to Java routines.
As LONGVARCHAR is simply an alias for VARCHAR(16M) or CLOB(16M)
depending on the setting, it would be better to specify VARCHAR with a
size. If you set a 1M size for your clob, larger data items will be
rejected.
Fred
On Thu, Mar 21, 2013, at 21:39, Tmo_hsqldb_q wrote:
> Understood. The compression will also be very useful!
> Correct me if i'm wrong. In the below example I'll have to cast the
> clobcolumn to longvarchar in the Trigger declaration, because as you
> described earlier in the chain:
> "In general, BLOB and CLOB cannot be used as parameters to Java routines,
> "
>
>
>
>
>
> CREATE TABLE testtable3
> (
> clobcolumn CLOB(1M) NOT NULL
> );
>
>
>
> CREATE TRIGGER testtable3_TRIG AFTER INSERT ON testtable3
> referencing NEW ROW AS newrow
> FOR EACH ROW WHEN (newrow.clobcolumn IS NOT NULL)
> CALL testtableupdate3(CAST(newrow.clobcolumn AS LONGVARCHAR));
>
>
>
>
> CREATE PROCEDURE testtableupdate3(testmessage LONGVARCHAR)
> MODIFIES SQL DATA
> LANGUAGE JAVA
> EXTERNAL NAME 'CLASSPATH:TestTableTrigger.testTableUpdate'
>
>
>
>
> import java.sql.*;
>
> public class TestTableTrigger
> {
>
> public static void testTableUpdate(Connection triggerConn, String
> testmessage) throws Exception
> {
>
> System.out.println("TestTableTrigger -
> testmessage =
> " + testmessage);
> }
>
> }
>
>
> CREATE PROCEDURE testclob(testmessage CLOB(1M))
> MODIFIES SQL DATA
> BEGIN ATOMIC
>
> INSERT INTO testtable3(clobcolumn)
> VALUES(testmessage);
>
> END
>
>
>
>
> --
> View this message in context:
> http://hsqldb.10974.n7.nabble.com/Error-with-Clob-tp151p3860.html
> Sent from the HSQLDB - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> Hsqldb-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hsqldb-user
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar