db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dhananjay Muli <dhanum...@yahoo.co.in>
Subject Problem with valueSpecification() grammar rule
Date Sun, 28 Oct 2007 12:52:28 GMT
Hello,
    I am facing problem with a query in postgresql having following condition in where clause

bullyear=(acadyear-year+1) 

where acadyear, bullyear and year are columns of table. The existing sqlgrammar.jj file has
a problem parsing the 'year' token occurence after the '-' sign. It expects a literal value
there. The exception while parsing the query is given at the end. I modified valueSpecification()
rule to add a new rule (the first one in the two rules given below) so that grammar should
also allow column reference along with literal values.

    value = columnReference() 
    {
        return value;
    }
|
    value = literal()
    {
        return value;
    }
|

The exception still exists even after addition of this rule. Am I missing something? Please
help.

Dhananjay

Exception in thread "main" org.apache.derby.impl.sql.compile.ParseException: Encountered "year"
at line 1, column 458.
Was expecting one of:
    <IDENTIFIER> ...
    <DELIMITED_IDENTIFIER> ...
    "abs" ...
    "absval" ...
    "action" ...
    "after" ...
    "always" ...
    "before" ...
    "binary" ...
    "blob" ...
    "c" ...
    "called" ...
    "class" ...
    "clob" ...
    "coalesce" ...
    "cobol" ...
    "committed" ...
    "compress" ...
    "concat" ...
    "contains" ...
    "content" ...
    "count" ...
    "cs" ...
    "curdate" ...
    "curtime" ...
    "d" ...
    "data" ...
    "date" ...
    "day" ...
    "dirty" ...
    "dynamic" ...
    "database" ...
    "db2sql" ...
    "document" ...
    "each" ...
    "empty" ...
    "exclusive" ...
    "fn" ...
    "fortran" ...
    "generated" ...
    "identity_val_local" ...
    "increment" ...
    "index" ...
    "initial" ...
    "interval" ...
    "java" ...
    "language" ...
    "large" ...
    "lcase" ...
    "length" ...
    "level" ...
    "locate" ...
    "lock" ...
    "locks" ...
    "locksize" ...
    "logged" ...
    "long" ...
    "message_locale" ...
    "method" ...
    "mod" ...
    "mode" ...
    "modifies" ...
    "modify" ...
    "module" ...
    "month" ...
    "more" ...
    "mumps" ...
    "name" ...
    "nclob" ...
    "new" ...
    "new_table" ...
    "nullable" ...
    "number" ...
    "object" ...
    "off" ...
    "old" ...
    "old_table" ...
    "oj" ...
    "pascal" ...
    "passing" ...
    "pli" ...
    "precision" ...
    "properties" ...
    "reads" ...
    "ref" ...
    "release" ...
    "rename" ...
    "repeatable" ...
    "referencing" ...
    "reset" ...
    "restart" ...
    "result" ...
    "retain" ...
    "returning" ...
    "returns" ...
    "row" ...
    "rr" ...
    "rs" ...
    "scale" ...
    "savepoint" ...
    "sequence" ...
    "sequential" ...
    "serializable" ...
    "sets" ...
    "share" ...
    "specific" ...
    "sqlid" ...
    "sql_tsi_frac_second" ...
    "sql_tsi_second" ...
    "sql_tsi_minute" ...
    "sql_tsi_hour" ...
    "sql_tsi_day" ...
    "sql_tsi_week" ...
    "sql_tsi_month" ...
    "sql_tsi_quarter" ...
    "sql_tsi_year" ...
    "sqrt" ...
    "stability" ...
    "start" ...
    "statement" ...
    "strip" ...
    "synonym" ...
    "style" ...
    "t" ...
    "then" ...
    "time" ...
    "timestamp" ...
    "timestampadd" ...
    "timestampdiff" ...
    "trigger" ...
    "truncate" ...
    "ts" ...
    "type" ...
    "ucase" ...
    "uncommitted" ...
    "ur" ...
    "usage" ...
    "value" ...
    "varbinary" ...
    "parameter" ...
    "when" ...
    "whitespace" ...
    "+" ...
    "-" ...
    <EXACT_NUMERIC> ...
    <APPROXIMATE_NUMERIC> ...
    <STRING> ...
    <HEX_STRING> ...
    "{" ...
    "true" ...
    "false" ...
    "?" ...
    "user" ...
    "current_user" ...
    "session_user" ...
    "nullif" ...
    "case" ...
    "(" ...
    "cast" ...
    
    at org.apache.derby.impl.sql.compile.SQLParser.generateParseException(SQLParser.java:22255)
    at org.apache.derby.impl.sql.compile.SQLParser.jj_consume_token(SQLParser.java:22104)
    at org.apache.derby.impl.sql.compile.SQLParser.primaryExpression(SQLParser.java:2842)
    at org.apache.derby.impl.sql.compile.SQLParser.unaryExpression(SQLParser.java:5795)
    at org.apache.derby.impl.sql.compile.SQLParser.multiplicativeExpression(SQLParser.java:5704)
    at org.apache.derby.impl.sql.compile.SQLParser.additiveExpression(SQLParser.java:5627)
    at org.apache.derby.impl.sql.compile.SQLParser.predicate(SQLParser.java:5376)
    at org.apache.derby.impl.sql.compile.SQLParser.booleanPrimary(SQLParser.java:5362)
    at org.apache.derby.impl.sql.compile.SQLParser.isSearchCondition(SQLParser.java:5313)
    at org.apache.derby.impl.sql.compile.SQLParser.andExpression(SQLParser.java:5279)
    at org.apache.derby.impl.sql.compile.SQLParser.orExpression(SQLParser.java:5235)
    at org.apache.derby.impl.sql.compile.SQLParser.valueExpression(SQLParser.java:5209)
    at org.apache.derby.impl.sql.compile.SQLParser.valueExpressionPrimary(SQLParser.java:7456)
    at org.apache.derby.impl.sql.compile.SQLParser.primary(SQLParser.java:6031)
    at org.apache.derby.impl.sql.compile.SQLParser.primaryExpressionXX(SQLParser.java:5854)
    at org.apache.derby.impl.sql.compile.SQLParser.primaryExpression(SQLParser.java:2839)
    at org.apache.derby.impl.sql.compile.SQLParser.unaryExpression(SQLParser.java:5795)
    at org.apache.derby.impl.sql.compile.SQLParser.multiplicativeExpression(SQLParser.java:5704)
    at org.apache.derby.impl.sql.compile.SQLParser.additiveExpression(SQLParser.java:5614)
    at org.apache.derby.impl.sql.compile.SQLParser.remainingNonNegatablePredicate(SQLParser.java:5474)
    at org.apache.derby.impl.sql.compile.SQLParser.remainingPredicate(SQLParser.java:5417)
    at org.apache.derby.impl.sql.compile.SQLParser.predicate(SQLParser.java:5395)
    at org.apache.derby.impl.sql.compile.SQLParser.booleanPrimary(SQLParser.java:5362)
    at org.apache.derby.impl.sql.compile.SQLParser.isSearchCondition(SQLParser.java:5313)
    at org.apache.derby.impl.sql.compile.SQLParser.andExpression(SQLParser.java:5279)
    at org.apache.derby.impl.sql.compile.SQLParser.orExpression(SQLParser.java:5235)
    at org.apache.derby.impl.sql.compile.SQLParser.valueExpression(SQLParser.java:5209)
    at org.apache.derby.impl.sql.compile.SQLParser.whereClause(SQLParser.java:11058)
    at org.apache.derby.impl.sql.compile.SQLParser.tableExpression(SQLParser.java:9676)
    at org.apache.derby.impl.sql.compile.SQLParser.querySpecification(SQLParser.java:4895)
    at org.apache.derby.impl.sql.compile.SQLParser.simpleTable(SQLParser.java:4866)
    at org.apache.derby.impl.sql.compile.SQLParser.nonJoinQueryPrimary(SQLParser.java:4842)
    at org.apache.derby.impl.sql.compile.SQLParser.nonJoinQueryTerm(SQLParser.java:4717)
    at org.apache.derby.impl.sql.compile.SQLParser.queryExpression(SQLParser.java:4623)
    at org.apache.derby.impl.sql.compile.SQLParser.preparableSelectStatement(SQLParser.java:2187)
    at org.apache.derby.impl.sql.compile.SQLParser.preparableSQLDataStatement(SQLParser.java:1988)
    at org.apache.derby.impl.sql.compile.SQLParser.StatementPart(SQLParser.java:1785)
    at org.apache.derby.impl.sql.compile.SQLParser.Statement(SQLParser.java:1680)
    at org.apache.derby.impl.sql.compile.SQLParser.main(SQLParser.java:22362)




      Get the freedom to save as many mails as you wish. To know how, go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
Mime
View raw message