db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: cannot create a function with no arguments
Date Thu, 06 Sep 2007 14:12:20 GMT
Hi  Mike,

I think the problem is the datatype of the function's return value. The 
VARCHAR datatype needs a length. This should work:

CREATE FUNCTION FUNC_NO_ARGS() RETURNS VARCHAR( 100 )
...

Hope this helps,
-Rick



Mike Norman wrote:
> latest Derby:
>   Apache Derby
>   10.3.1.4 - (561794)
>   Apache Derby Network Client JDBC Driver
>   10.1.2.1
>
> I have an extremely simple helper class:
>
>   package test;
>
>   import java.sql.SQLException;
>
>   public class SPHelper {
>
>       public static void ProcNoArgs() throws SQLException {
>       }
>     
>       public static String FuncNoArgs() throws SQLException {
>           return "gidday";
>       }
>   }
>
> The first external procedure works:
>
>   CREATE PROCEDURE PROC_NO_ARGS() 
>   LANGUAGE JAVA 
>   EXTERNAL NAME 'test.SPHelper.ProcNoArgs' 
>   PARAMETER STYLE JAVA
>   NO SQL
>
> but I cannot create a no-arg function:
>
>   CREATE FUNCTION FUNC_NO_ARGS() RETURNS VARCHAR
>   LANGUAGE JAVA
>   EXTERNAL NAME 'test.SPHelper.FuncNoArgs'
>   PARAMETER STYLE JAVA
>   NO SQL
>   CALLED ON NULL INPUT
>
> I get the following exception:
>
>  09:43:30  [CREATE - 0 row(s), 0.000 secs]  [Error Code: -1, SQL State:
> 42X01]  Syntax error: Encountered "LANGUAGE" at line 2, column 3.
> ... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000
> sec [0 successful, 0 warnings, 1 errors]
>
> Any ideas?
>
>
>   


Mime
View raw message