schema_name=”Your Schema name”;
{
"privileges": [{
"name": "Basic",
"description": "Basic usage privilege"
}]
}
1. {
2. "exposed": true,
3. "authentication": [{
4. "method": "Basic"
5. }],
6. "authorization": ["YourSchemaName"::Basic"]
7. }
{}
role thedshop.roles::user {
sql object thedshop.data::inventory.ShopItems: SELECT, INSERT, UPDATE, DELETE;
sql object thedshop.procedures::createItems: EXECUTE;
sql object thedshop.data:items.hdbsequence: SELECT;
application privilege: thedshop::Basic;
}
namespace thedshop.data;
@Schema: 'THEDSHOP'
context inventory {
type myKeyType: String(60);
@Catalog.tableType:
#COLUMN
Entity ShopItems {
key itemId: Integer;
name: String(50);
description: String(140);
serialNumber: String(100);
quantity: Integer;
images: CLOB;
};
context procedures{
type items {
itemId: Integer;
name: String(50);
description: String(140);
serialNumber: String(100);
quantity: Integer;
images: CLOB;
};
type errors {
HTTP_STATUS_CODE : Integer;
ERROR_MESSAGE : String(100);
DETAIL : String(100);
};
};
STEP 6
Create file <your-file-name>.hbdti. This file will represent the Hana Data Base Table Import.
(In the table-import configuration, the table, cdstable, and hdbtable, the keywords can allow us to specify the name of the target table into which the table-import operation must insert data.)
The target table specified in the table-import configuration can be a runtime table in the catalog or a design-time table definition, for example, a table defined using either the .hdbtable or the .hdbdd (Core Data Services) syntax.
import = [
{
table = "thedshop.data::inventory.ShopItems";
schema = "THEDSHOP";
file = "thedshop.data.loads:shopItems.csv";
header = false;
}
];
PROCEDURE "THEDSHOP"."thedshop.procedures::createItems"(
IN intab "THEDSHOP"."thedshop.data::inventory.procedures.items",
OUT outtab "THEDSHOP"."thedshop.data::inventory.procedures.errors"
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
AS
BEGIN
DECLARE lv_itemId INTEGER;
DECLARE lv_name STRING;
DECLARE lv_description STRING;
DECLARE lv_serialNumber STRING;
DECLARE lv_quantity INTEGER;
DECLARE lv_images NCLOB;
SELECT "itemId",
"name",
"description",
"serialNumber",
"quantity"
"images"
INTO lv_itemId,
lv_name,
lv_description,
lv_serialNumber,
lv_quantity,
lv_images
FROM :intab;
IF (:lv_name = '') THEN
outtab = SELECT 500 AS http_status_code,
i. 'Invalid name ' || lv_name AS error_message,
ii. 'No Way! Item name must not be empty' AS detail
iii. FROM dummy;
ELSE
INSERT INTO "thedshop.data::inventory.ShopItems" VALUES("thedshop.data::items".NEXTVAL, lv_name, lv_description, lv_serialNumber, lv_quantity,lv_images);
END IF;
END;
STEP 8
schema= "THEDSHOP";
start_with= 24;
maxvalue= 1000000000;
nomaxvalue=false;
minvalue= 24;
nominvalue=true;
cycles= false;
depends_on_table= "thedshop.data::inventory.ShopItems";
Final Step
service {
"YourSchemaName::NameOfYourhdbddFile.TableName" as "Contact"
create using "YourSchemaName.procedures::tableName";
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
24 | |
13 | |
10 | |
9 | |
7 | |
7 | |
7 | |
7 | |
6 |