How to refer to a CONSTRAINT by SELECT?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to refer to a CONSTRAINT by SELECT?

Omari Stephens-4
This is a follow-on to the SCHEMA modification question.  Here's where I'm at right now:

query = String.format("ALTER TABLE %s " +
        "DROP CONSTRAINT ( " +
            "SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " +
            "WHERE TABLE_NAME = %s AND CONSTRAINT_TYPE = 'PRIMARY KEY' " +
        ") CASCADE",
        TABLE, TABLE);
sql.execute(query);


This is apparently invalid syntax:
java.sql.SQLSyntaxErrorException: unexpected token: (

So the SELECT statement is correct.  I'm pretty sure the DROP CONSTRAINT statement is correct also.  How do I put them together?

Thanks,
--xsdg

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user