Frank Schönheit - Sun Microsystems Germany wrote:
Hello Barbara,

Hmm. In the Execute SQL Statement dialog, I had
UPDATE "Addresses" SET ADDR = TRIM ( ADDR )

What I got was an error:
2: Unexpected token in statement [UPDATE "Addresses" SET ADDR = TRIM ( ADDR]

Note that it seems to have dropped the closing paren, and the preceding blank - I have no idea why.

Even if Andrew already pointed us to RTRIM/LTRIM, as the better options
let me comment on this one:

According to http://hsqldb.org/doc/guide/ch09.html#N124AF, the syntax of
TRIM somewhat different from what you'd expect. What the message tells
you is that after "TRIM(", HSQL's parser expected something other than
the ADDR it encountered (more precise, it expected one of
LEADING/TRAINLING/BOTH/FROM).

So, the complete syntax if you want to use TRIM is
  UPDATE "Addresses" SET ADDR = TRIM ( BOTH FROM ADDR )
where you can even omit the BOTH.

Ciao
Frank

... and that's exactly what I did, once I found the TRIM description in the HSQLDB documentation. (You may not have seen my note about that, it was a response to Marc elsewhere in the thread.) I didn't see a way that it indicated BOTH was the default, though, if that's what you meant to imply. Here's the snippet I quoted before:

TRIM( LEDING ... FROM ...)^[1 <http://www.hsqldb.org/doc/guide/ch09.html#ftn.posthyper>]

   |TRIM([{LEADING | TRAILING | BOTH}] FROM <string expression>)|

(The footnote says "These features were added by HSQL Development Group since April 2001")

Here's what the syntax notes say:

|[A]| means A is optional.

|{ B | C }| means either B or C must be used.

|[{ B | C }]| means either B or C may optionally be used, or nothing at all.

|(| and |)| are the actual characters '(' and ')' used in statements.

UPPERCASE words are keywords

So I can see that the argument could be left out, but how does it identify which possibility is the default? If anything, I'd expect it to be LEADING rather than BOTH, since that is listed first and is (sort of) in the function heading. Generally, I'm used to some kind of syntactic convention identifying the default, usually bolding or italicizing. After all, the code has to choose SOME interpretation from a choice like this, it would be nice to know which. Am I missing a convention here?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to