28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

If you want to define a transportable sequence using the design-time sequence specifications, use the<br />

configuration schema illustrated in the following example.<br />

string schema;<br />

int32 increment_by(default=1);<br />

int32 start_with(default=-1);<br />

optional int32 maxvalue;<br />

bool nomaxvalue(default=false);<br />

optional int32 minvalue;<br />

bool nominvalue(default=false);<br />

optional bool cycles;<br />

optional string reset_by;<br />

bool public(default=false);<br />

optional string depends_on_table;<br />

optional string depends_on_view;<br />

The following example shows the contents of a valid sequence-definition file for a sequence called MYSEQUENCE.<br />

schema= "TEST_DUMMY";<br />

start_with= 10;<br />

maxvalue= 30;<br />

nomaxvalue=false;<br />

minvalue= 1;<br />

nominvalue=true;<br />

cycles= false;<br />

reset_by= "SELECT \"Col2\" FROM \"TEST_DUMMY\".<br />

\"com.sap.test.tables::MY_TABLE\" WHERE \"Col2\"='12'";<br />

depends_on_table= "com.sap.test.tables::MY_TABLE";<br />

The sequence is stored in the repository with the suffix hdbsequence, for example, MYSEQUENCE.hdbsequence.<br />

If you activate a sequence-definition object in <strong>SAP</strong> <strong>HANA</strong> XS, the activation process checks if a sequence with the<br />

same name already exists in the <strong>SAP</strong> <strong>HANA</strong> repository. If a sequence with the specified name does not exist, the<br />

repository creates a sequence with the specified name and makes _SYS_REPO the owner of the new sequence.<br />

Note: The sequence cannot be dropped even if the deletion of a sequence object is activated.<br />

5.6 Creating Sequences<br />

A database sequence generates a serial list of unique numbers that you can use while transforming and moving<br />

data to between systems.<br />

<strong>SAP</strong> <strong>HANA</strong> Extended Application Services (<strong>SAP</strong> <strong>HANA</strong> XS) enables you to create a database sequence as a<br />

design-time file in the repository.<br />

To create a sequence definition file in the repository, perform the following steps:<br />

1. Start the <strong>SAP</strong> <strong>HANA</strong> studio.<br />

2. Open the <strong>SAP</strong> <strong>HANA</strong> Development perspective.<br />

3. Open the Project Explorer view.<br />

4. Create the sequence-definition file.<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Setting Up the Persistence Model<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved. 79

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!