Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 39151 invoked from network); 6 Sep 2007 14:13:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Sep 2007 14:13:08 -0000 Received: (qmail 85378 invoked by uid 500); 6 Sep 2007 14:13:00 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 85351 invoked by uid 500); 6 Sep 2007 14:13:00 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 85340 invoked by uid 99); 6 Sep 2007 14:13:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 07:13:00 -0700 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.43.132] (HELO sca-es-mail-1.sun.com) (192.18.43.132) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 14:12:55 +0000 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id l86ECVt0029222 for ; Thu, 6 Sep 2007 07:12:32 -0700 (PDT) Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JNY00901A3HC300@fe-sfbay-09.sun.com> (original mail from Richard.Hillegas@Sun.COM) for derby-user@db.apache.org; Thu, 06 Sep 2007 07:12:31 -0700 (PDT) Received: from richard-hillegas-computer.local ([129.150.16.92]) by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JNY00L6NA4VQTD0@fe-sfbay-09.sun.com> for derby-user@db.apache.org; Thu, 06 Sep 2007 07:12:31 -0700 (PDT) Date: Thu, 06 Sep 2007 07:12:20 -0700 From: Rick Hillegas Subject: Re: cannot create a function with no arguments In-reply-to: <12523237.post@talk.nabble.com> Sender: Richard.Hillegas@Sun.COM To: Derby Discussion Message-id: <46E00AC4.1080300@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT References: <12523237.post@talk.nabble.com> User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) X-Virus-Checked: Checked by ClamAV on apache.org 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? > > >