Management and Administration > Workspace Management > Management Console > SmartObject Services > SmartObject Services > The K2 Oracle Service > Oracle Tables | Send feedback |
All the CRUD (CREATE, READ, UPDATE, DELETE) methods including LIST will only be created as Service Object methods if there is a primary key on the table. If there is no primary key on the table only a List method will be created.
There is no concept of an Identity Key in Oracle. You can only designate a column as a Primary Key. To provide an “auto-increment” value to a Primary Key (or any field you wish) you need to create or use a Sequence. Sequences are scoped database wide. You can ask a Sequence for the next available value which you can use to insert into the Primary key field. To automate it, you create a trigger on INSERT to get the next value from Sequence before inserting. It is possible for more than 1 table to use the same Sequence. It is therefore good practice to name the sequence something that identifies it with the table name. For example: In K2 a situation could arise where a table might have a Primary key which is NOT NULLABLE. |
Important: Output parameters are unsupported. |
Fig. 1. Oracle Service Object Tables methods displayed in the K2 Object Browser
With CRUD methods: In this sample code CREATE, READ, UPDATE, DELETE and LIST methods will be created as there is a primary key on the table.
Copy Code |
---|
CREATE TABLE STUDENT( STUDENT_ID NUMBER PRIMARY KEY, SALUTATION VARCHAR(5) NULL, FIRST_NAME VARCHAR(25) NULL, LAST_NAME VARCHAR(25) NULL, STREET_ADDRESS VARCHAR (50) NULL, ZIP VARCHAR(5) NULL, PHONE VARCHAR(15) NULL, EMPLOYER VARCHAR(50) NULL )
|