I don't think sed can do that, no. You could use awk to do that, or a combination of utilities like grep and cut with sed. grep to find the line with DECLARE1, cut to remove the extraneous characters, sed to replace.
But sed doesn't really do variables, no. awk does, and as it works line by line it might be better for what you're after.