masters~ I'm having trouble converting Oracle SQL to DB2.
I need to change these Oracle SQLs to DB2.
Please help me
CREATE TABLE ABC (
AA VARCHAR(10 BYTE) WITH DEFAULT TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS')
);
CREATE TABLE CBA (
BB INTEGER(22) NOT NULL
) PCTFREE 10 TABLESPACE CC STORAGE (INITIAL 32K NEXT 32K) NOLOGGING;
What with all the concerns @Bob Jarvis mentioned in the comment to the original post, here is some rough equivalents that might get you by. You should probably consult the Information Center documentation a bit for further reference.
CREATE TABLE ABC (
AA TIMESTAMP WITH DEFAULT CURRENT TIMESTAMP GENERATED BY DEFAULT
);
CREATE TABLE CBA (
BB BIGINT NOT NULL
);
If you're generating timestamps, you should store them as such, not as character strings.
Also, there is a NOT LOGGED
option on DB2 tables, but it is only valid for LOB
data types. (Or, there is NOT LOGGED INITIALLY
, which will not log any changes that are applied in the same unit of work as the table creation, which is useful, for example, when importing data from another source [file or other table, perhaps])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.