dean wrote:
> sSQL =
> " update SELECTED_NODES "
> " set LABEL_S = 'Y' "
> " where NODE_I in "
> " ( "
> " select NODE_I "
> " from "
> " ( "
> " select ONODE_I NODE_I from link "
> " union all "
> " select DNODE_I NODE_I from link "
> " ) ALL_NODES "
> " group by NODE_I "
> " having count(*) > 2 "
> " ) ";
>
> Is there a super-quote I can add at the start of that statement, so I
> don't need all the double quotes on each line? Something like /* and */
> but for strings and not comments.
That pattern is called PerniciousIngrownSql. You are asking how to make the
SQL easier to in-grow.
Instead, consider writing a simple system that generates SQL with streams,
like this:
stringstream q;
update(q, selectedNodesTable);
q << "set LABEL_S = 'Y'";
q << "where NODE_I in "
selectNode_I(q);
I pushed some of your strings into simple functions. As you write more SQL,
you will re-use these simple functions. If your program grows very complex,
that suite of simple functions will start to work as a "persistence layer".
But if you program does not grow complex (a good thing), then they won't.
They will just keep helping you write SQL statements that don't duplicate
all their contents everywhere.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!