Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 82972 invoked from network); 5 Oct 2006 14:02:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Oct 2006 14:02:30 -0000 Received: (qmail 59355 invoked by uid 500); 5 Oct 2006 14:02:28 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 59319 invoked by uid 500); 5 Oct 2006 14:02:27 -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 Delivered-To: moderator for derby-user@db.apache.org Received: (qmail 48313 invoked by uid 99); 5 Oct 2006 13:58:19 -0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=UPPERCASE_25_50 Message-ID: <45250EC5.5010808@smartbro.net> Date: Thu, 05 Oct 2006 15:55:17 +0200 From: jon INFANTE Reply-To: joninfante@smartbro.net User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: derby-user@db.apache.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-MailScanner-Information: X-MailScanner: Found to be clean X-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.399, required 8, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -2.60, UPPERCASE_25_50 0.00) X-MailScanner-From: joninfante@smartbro.net Subject: HELP on creating SQL function X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi good day, Im new derby and new in creating a SQL function in derby, I need a function that will return a string value: here is the SQL of the function, Im trying to work on, I do encounter an error when I try to compile this (Syntax error : MISSING ELEMENT) what Im missing here ??? CREATE FUNCTION LOG_STATUS(ATTRIBUTE_ID INTEGER) RETURNS VARCHAR(25) LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA RETURNS NULL ON NULL INPUT RETURN SELECT CASE WHEN log.logvalue > attribute.maxlevel THEN 'Failed' WHEN (log.logvalue IS NULL) OR (attribute.maxlevel IS NULL) THEN 'N/A' ELSE 'passed' END FROM log log,attribute attribute WHERE log.refattribute = attribute.id AND log.refattribute = LOG_STATUS.ATTRIBUTEID EXTERNAL NAME 'myfunction.logStatus' Hoping for your prompt reply.. Thanks in advance.. Jon