Syscontraints problem - please help! (Pretty please!)
Posted in 1995
Dear All, I have to admit - I'm stumped! We are working on an error-handler which is "constraint-aware". We get the name of the constraint which is broken from SQLCA.SQLERRM, chop off the owner name, stick it into a variable and then try and look it up in syscontraints. And of course, it isn't found. We PREPARE and DECLARE a CURSOR like this: -- this doesn't work... LET sql_stmt = "SELECT * FROM syscontraints WHERE constrname = ?" PREPARE ... DECLARE ... -- Debugger says err_txt = "cc1" OPEN ... USING err_txt FETCH ... -- returns SQLCA.SQLCODE = 100 and when we OPEN using our chopped SQLCA.SQLERRM, the FETCH fails with NOTFOUND. However, if we hardwire the constraint name into the variable (and we've checked this over and over), it finds data! Is there something non-ASCII in SQLCA.SQLERRM, or anything we're missing? -- this works! LET sql_stmt = "SELECT * FROM syscontraints WHERE constrname = ?" PREPARE ... DECLARE ... LET err_txt = "cc1" OPEN ... USING err_txt FETCH ... -- returns SQLCA.SQLCODE = 0 *Any* comments would be appreciated... TIA. -- Cheers, Billy ----------------------------------------------------------------------------- INCLUDE "Disclaimer.4gh" -- my opinions are INCLUDE "FlamesToDevNull.4gh" -- flamers, eat my shorts! INCLUDE "CaveatEmptor.4gh" -- take my advice at your own risk INCLUDE "ThirtySomething.4gh" -- header file for this class -- Written by : Billy Wheeler, Date: today -- Copyright (c) 1995, The West Solutions Group