473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Difference in default constraint syntax between LUW and z/OS?

BD
Hi, all..

I'm creating a table with one column of type DATE, non nullable, with
a default of the current date.

The column syntax I'm using is "THIS_DATE_1 DATE NOT NULL DEFAULT
CURRENT DATE"

On LUW, the constraint compiles - I insert a row and the date value is
inserted with the correct default.

The same syntax appears to be failing on zOS:

IBM][CLI Driver][DB2] SQL0104N An unexpected token "DATE" was found
following "". Expected tokens may include: "SQLID". SQLSTATE=42601

I've done some digging on the SQL0104N error, and it's generic enough
to be less than helpful.

I'm looking through the online docs to see if there's a difference in
syntax requirements between LUW and z/OS as regards this particular
instance.

Thanks all, for any suggestions...

Apr 7 '08 #1
4 3249
BD
Looking at the CREATE TABLE syntax diagram [1] I don't think this is
possible. Specifically, this bit:
Well, here's my session log...

db2 =CREATE TABLE MYSCHEMA.DATETEST ( TEST_INT INTEGER ,
TEST_DATE DATE NOT
NULL DEFAULT CURRENT DATE)
DB20000I The SQL command completed successfully.

db2 =INSERT INTO MYSCHEMA.DATETEST (TEST_INT) values (1)
DB20000I The SQL command completed successfully.

db2 =SELECT * FROM MYSCHEMA.DATETEST

TEST_INT TEST_DATE
----------- ----------
1 04/07/2008

1 record(s) selected.
....
Apr 7 '08 #2
BD wrote:
>
Looking at the CREATE TABLE syntax diagram [1] I don't think this is
possible. Specifically, this bit:

Well, here's my session log...

db2 =CREATE TABLE MYSCHEMA.DATETEST ( TEST_INT INTEGER ,
TEST_DATE DATE NOT
NULL DEFAULT CURRENT DATE)
DB20000I The SQL command completed successfully.

db2 =INSERT INTO MYSCHEMA.DATETEST (TEST_INT) values (1)
DB20000I The SQL command completed successfully.

db2 =SELECT * FROM MYSCHEMA.DATETEST

TEST_INT TEST_DATE
----------- ----------
1 04/07/2008

1 record(s) selected.
...
Sorry, I should've clarified that: looking at the CREATE TABLE syntax
diagam for DB2 for z/OS..., naturally it works fine on DB2 for LUW
Cheers,

Dave.
Apr 7 '08 #3
BD
On Apr 7, 2:54*pm, "Dave Hughes" <d...@waveform.plus.comwrote:
BD wrote:
Looking at the CREATE TABLE syntax diagram [1] I don't think this is
possible. Specifically, this bit:
Well, here's my session log...
db2 =CREATE TABLE MYSCHEMA.DATETEST ( *TEST_INT *INTEGER *,
TEST_DATE *DATE *NOT
*NULL *DEFAULT CURRENT DATE)
DB20000I *The SQL command completed successfully.
db2 =INSERT INTO MYSCHEMA.DATETEST (TEST_INT) values (1)
DB20000I *The SQL command completed successfully.
db2 =SELECT * FROM MYSCHEMA.DATETEST
TEST_INT * *TEST_DATE
----------- ----------
* * * * * 1 04/07/2008
* 1 record(s) selected.
...

Sorry, I should've clarified that: looking at the CREATE TABLE syntax
diagam for DB2 for z/OS..., naturally it works fine on DB2 for LUW

Cheers,

Dave.- Hide quoted text -

- Show quoted text -
Mmm... yes, and that was what I was in the process of digging up when
I posted the question. The SQL guides which I'm using are not platform-
specific, from what I can see. I must say, it's a little frustrating,
developing under LUW for an application which runs on z/OS. The
discrepancies I've seen are not many, but they are subtle enough to
cause some confusion.

I should probably get my hands on a better set of syntax docs.

Thanks for the feedback!

BD
Apr 7 '08 #4
Dave Hughes wrote:
BD wrote:
>>Looking at the CREATE TABLE syntax diagram [1] I don't think this is
possible. Specifically, this bit:
Well, here's my session log...

db2 =CREATE TABLE MYSCHEMA.DATETEST ( TEST_INT INTEGER ,
TEST_DATE DATE NOT
NULL DEFAULT CURRENT DATE)
DB20000I The SQL command completed successfully.

db2 =INSERT INTO MYSCHEMA.DATETEST (TEST_INT) values (1)
DB20000I The SQL command completed successfully.

db2 =SELECT * FROM MYSCHEMA.DATETEST

TEST_INT TEST_DATE
----------- ----------
1 04/07/2008

1 record(s) selected.
...

Sorry, I should've clarified that: looking at the CREATE TABLE syntax
diagam for DB2 for z/OS..., naturally it works fine on DB2 for LUW
http://www.ibm.com/developerworks/db...206sqlref.html

Perhaps I should post a topic on this....

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Apr 7 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Luc Martineau | last post by:
Hello When we create a table, what is the difference between the REFERENCE constraint on column and the FOREIGN KEY constraint on table ? I guess that the FOREIGN KEY constraint assures us...
3
by: M Simpson | last post by:
/* for the google index */ ALTER TABLE DEFAULT COLUMN DEFAULT VALUE I've worked out several stored procedures for altering the default column values in a table. They were compiled from books...
4
by: David Wright | last post by:
How can i change the default value of a column? I already have a column named DateOfRental but I want to alter it so that it has default value getdate() Thanks David --...
10
by: serge | last post by:
I am doing a little research on Google about this topic and I ran into this thread: ...
5
by: aj | last post by:
DB2 WSE 8.1 FP5 Red Hat AS 2.1 What is the difference between adding a unique constraint like: ALTER TABLE <SCHEMA>.<TABLE> ADD CONSTRAINT CC1131378283225 UNIQUE ( <COL1>) ; and adding a...
4
by: Jethro Guo | last post by:
C++ template use constraint by signature,It's very flexible to programmer but complex for complier, and at most time programmer can not get clear error message from complier if error occur. C#...
6
by: Giacomo | last post by:
Hi, I've the following problem. I must delete a column DEFAULT from a table, but I must do it with a script, independently from the server where it'll be executed. Locally I've tried with: ...
6
by: fcvcnet | last post by:
Hi, I read the book C++ Primer, Fourth Edition By Stanley B. Lippman, Jos¨¦e Lajoie, Barbara E. Moo "If we define a class using the class keyword, then any members defined before the first...
5
by: sreemati | last post by:
Hi I am working on SQL SERVER 200 and I am trying to drop the default constraints set in few tables. I tired to follow the instructions given in MSDN for dropping a default: 1) Unbind the code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.