cancel
Showing results for 
Search instead for 
Did you mean: 

Defaut values of table columns

0 Kudos

We are migrating from oracle DB to HANA db.

When se11 generate the table with char column, the default value when working with Oracle was ' ':

CREATE

COLUMN TABLE 'ZTABLE'

('MANDT' NVARCHAR (000003)

DEFAULT '000' NOT NULL,

'RELID' NVARCHAR (000002)

DEFAULT ' ' NOT NULL,

when generating the same table in HANA the create table statement is:

CREATE TABLE 'ZTEMPORARY_STORE'

('MANDT' VARCHAR2 (000009)

DEFAULT '000' NOT NULL,

'RELID' VARCHAR2 (000006)

DEFAULT '' NOT NULL,

Can we control the default values?

Best regards,

Yotam

michael_eaton3
Active Contributor

NetWeaver stores no value (not really null) as a space in Oracle and an empty string in HANA. The reason for this is that Oracle treats an empty string as null, and that can cause issues in SQL.

Accepted Solutions (0)

Answers (1)

Answers (1)

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

yotamdan

Yes, you can control the default values in HANA DB table creation. You can specify the default value for a column in the CREATE TABLE statement itself. Here is an example:

<code>CREATE TABLE "ZTABLE"
(
  "MANDT" NVARCHAR(000003) DEFAULT '000' NOT NULL,
  "RELID" NVARCHAR(000002) DEFAULT ' ' NOT NULL,
  "FIELD1" NVARCHAR(000010) DEFAULT '0' NOT NULL,
  "FIELD2" NVARCHAR(000010) DEFAULT '0' NOT NULL,
  PRIMARY KEY ("MANDT", "RELID")
);
0 Kudos

Hi Yogananda,

Can I control it system-wide and not changing all the tables one by one?

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos
yotamdan

you can use SAP Advanced SQL Migration Tool which you can do complete orcale db... you can download and execute

https://tools.hana.ondemand.com/#hanatools