You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by ri...@rswheeldon.com on 2006/09/02 23:40:29 UTC

substring/concat/curdate/curtime

Are these supposed to work? They're declared in the grammar,
appear to have useful code associated with them, but none
of them seem to do anything:

ij> select substring('s',2) from simple_tab;
ERROR 42X01: Syntax error: Encountered "substring" at line 1, column 8.
ij> select substring('s',1,2) from simple_tab;
ERROR 42X01: Syntax error: Encountered "substring" at line 1, column 8.
ij> select concat('ab', 'cd') from simple_tab;
ERROR 42Y03: 'CONCAT' is not recognized as a function or procedure.
ij> select curtime() from simple_tab;
ERROR 42Y03: 'CURDATE' is not recognized as a function or procedure.
ij> select curtime() from simple_tab;
ERROR 42Y03: 'CURTIME' is not recognized as a function or procedure.
ij> 

I think this is possibly related to the previous issues with
the use of builtins in views,

Regards,

Richard


Re: substring/concat/curdate/curtime

Posted by Daniel John Debrunner <dj...@apache.org>.
richard@rswheeldon.com wrote:

> Are these supposed to work? They're declared in the grammar,
> appear to have useful code associated with them, but none
> of them seem to do anything:

The grammer is not the definition of the functionality, the
documentation is:

All of these are the names for JDBC escape functions, introduced with
'{fn' and end with '}'.

Try this.

select {fn substring('s',2)} from simple_tab

The SQL functions for this functionality are:

SUBSTR
|| (concatenation operator)
CURRENT DATE or CURRENT_DATE
CURRENT TIME or CURRENT_TIME

http://db.apache.org/derby/docs/dev/ref/

Look at the builtin functions section.

Thanks,
Dan.


> ij> select substring('s',2) from simple_tab;
> ERROR 42X01: Syntax error: Encountered "substring" at line 1, column 8.
> ij> select substring('s',1,2) from simple_tab;
> ERROR 42X01: Syntax error: Encountered "substring" at line 1, column 8.
> ij> select concat('ab', 'cd') from simple_tab;
> ERROR 42Y03: 'CONCAT' is not recognized as a function or procedure.
> ij> select curtime() from simple_tab;
> ERROR 42Y03: 'CURDATE' is not recognized as a function or procedure.
> ij> select curtime() from simple_tab;
> ERROR 42Y03: 'CURTIME' is not recognized as a function or procedure.
> ij>