db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Ruehlicke" <BRuehli...@lgc.com>
Subject Problems using CHAR function in DEFAULT statment of a CREATE TABLE
Date Thu, 16 Dec 2004 19:58:44 GMT
Hi all,
I'm a Derby newby with a problem when using CHAR function as DEFAULT
value in a CREATE TABLE call.

this one works:
CREATE TABLE THISWORKS (num int, created_by varchar(40) default user,
create_date date default date(current_date))


Now I would like to have as default value the current date - but in a
varchar column.  Using "ij" the command 

ij> values char(current_date);
1          ---------- 2004-12-16 

works fine, but 

CREATE TABLE DOSENOTWORK (num int, created_by varchar(40) default user,
create_date_string varchar(40) default char(current_date))

give an error as below - any idea why ?!??!

B-)

 

DatabaseProductName: Apache Derby Connected to and created database
jdbc:derby:phsDB, of dbtype Apache Derby Embedded JDBC Driver TestDerby
starting in embedded mode. Dec 16, 2004 9:00:54 AM 
com.xyz.test.TestDerby test_createTableDefaultValues FINE: exception
thrown:DEFAULT value or IDENTITY attribute value is not valid for column
'CREATE_DATE_STRING'. ERROR 42894: DEFAULT value or IDENTITY attribute
value is not valid for column 'CREATE_DATE_STRING'. 	at
org.apache.derby.iapi.error.StandardException.newException(StandardExcep
tion.java) 	at
org.apache.derby.impl.sql.compile.SQLParser.DB2DefaultOption(SQLParser.j
ava) 	at
org.apache.derby.impl.sql.compile.SQLParser.defaultOption(SQLParser.java
) 	at
org.apache.derby.impl.sql.compile.SQLParser.defaultClause(SQLParser.java
) 	at
org.apache.derby.impl.sql.compile.SQLParser.defaultAndConstraints(SQLPar
ser.java) 	at
org.apache.derby.impl.sql.compile.SQLParser.columnDefinition(SQLParser.j
ava) 	at
org.apache.derby.impl.sql.compile.SQLParser.tableElement(SQLParser.java)
at
org.apache.derby.impl.sql.compile.SQLParser.tableElementList(SQLParser.j
ava) 	at
org.apache.derby.impl.sql.compile.SQLParser.tableDefinition(SQLParser.ja
va) 	at
org.apache.derby.impl.sql.compile.SQLParser.createStatements(SQLParser.j
ava) 	at
org.apache.derby.impl.sql.compile.SQLParser.StatementPart(SQLParser.java
) 	at
org.apache.derby.impl.sql.compile.SQLParser.Statement(SQLParser.java)
at
org.apache.derby.impl.sql.compile.ParserImpl.parseGoalProduction(ParserI
mpl.java) 	at
org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(ParserImpl.j
ava) 	at
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.j
ava) 	at
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java
) 	at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareI
nternalStatement(GenericLanguageConnectionContext.java) 	at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java)
at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java)
at
com.xyz.test.TestDerby.test_createTableDefaultValues(TestDerby.java:534)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39) 	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25) 	at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154) 	at
junit.framework.TestCase.runBare(TestCase.java:127) 	at
junit.framework.TestResult$1.protect(TestResult.java:106) 	at
junit.framework.TestResult.runProtected(TestResult.java:124) 	at
junit.framework.TestResult.run(TestResult.java:109) 	at
junit.framework.TestCase.run(TestCase.java:118) 	at
junit.framework.TestSuite.runTest(TestSuite.java:208) 	at
junit.framework.TestSuite.run(TestSuite.java:203) 	at
com.borland.jbuilder.unittest.JBTestRunner.run(JBTestRunner.java:210)
at
com.borland.jbuilder.unittest.JBTestRunner.initiateTest(JBTestRunner.jav
a:252) 	at
com.borland.jbuilder.unittest.JBTestRunner.main(JBTestRunner.java:558)
Closed connection


---
Bernd Ruehlicke, #4.620A          Tel:+1 713 839 3546 (direct)
Landmark Graphics R&D             Fax:+1 713 839 3527 
Data and Application Management 		  
Building 1, Suite 200             job     : bruehlicke@lgc.com
2101 CityWest Blvd.               private : bernd@ruehlicke.net 	
P.O. Box 42806                    http://www.lgc.com
Houston, TX 77242-2806                          
                                
       Largest prime known to man: 2^24036583 -1

Riemann hypothesis proof see http://www.math.purdue.edu/~branges/

Consequence: This leads to a deterministic primality test that has
runtime O(ln(n)^4)

This e-mail, including any attached files, may contain confidential and
privileged information for the sole use of the intended recipient(s).
Any review, use, distribution or disclosure by others is strictly
prohibited. If you are not the intended recipient (or authorized to
receive information for the recipient), please contact the sender by
reply e-mail and delete all copies of this message. Thank you.  
 

Mime
View raw message