Questions tagged [hana-sql-script]

The language for stored procedures and functions used in SAP HANA

SAP HANA SQL-Script is a collection of extensions to SQL. With those extensions you can create database procedures which will be stored on the SAP HANA database.

You can use sql-script via SAP-HANA-Studio which is an extension to eclipse.

Useful Links

151 questions
0
votes
2 answers

how to assign a variable in procedure in SAP HANA

here i tried to give discount based on quantity ordered by using procedure. but i dont know how assign a value of column to the variable in procedure. here my code: create column table "KABIL_PRACTICE"."SALES_IF_ELSE" ( "SALES_ID"…
KABIL ARASAN
  • 31
  • 1
  • 4
  • 12
0
votes
1 answer

Inventory Ageing Calculation view in Hana Studio

I want to make a calculation view in hana studio where I have to maintain ageing of product which is pending in Inventory. It will subtract on first come first basis...I mean in case of Product P001 then 5500 will subtract 1000 first then balance…
Arun Gupta
  • 31
  • 2
  • 8
0
votes
0 answers

Merging two procedures

I already saw some similar questions but with not much help. I already have two procedures with me, I need to merge it and and replace the internal table TT_SERIES with the database table named DB_WEEK_SERIES. I tried to merge but with errors. Below…
0
votes
1 answer

Calculate week end date

I am working on HANA and I am not able to figure it out how to get the expected output. Let me throw some light on getting the output. I am working on a procedure and my job is to get the data inserted in that particular table which I am…
0
votes
1 answer

Hierarchy table, update column for a particular level

So I have a hierarchy table in the following format: Instance | Parent | Serial | Hierarchy Level 1 | 0 | x0 | 1 2 | 0 | x1 | 1 3 | 1 | xy0 | 2 4 | 1 | xy1 | …
Alexis Alias
  • 23
  • 2
  • 7
0
votes
2 answers

Insert with select, dependent on the values in the table inserting into EDITED

So I need to figure out how to insert into a table, from another table, with a where clause that requires me to access the table that I am inserting into. I tried an alias from the table I am inserting into, but I quickly found out that you cannot…
Alexis Alias
  • 23
  • 2
  • 7
0
votes
1 answer

Creating a Column Store Table Type in HANA

I am trying to create a table type which has ARRAY as a column type in SAP HANA. When I use the standard DDL for creating the table type, i.e. CREATE TYPE MYSCHEMA.TABNAME AS TABLE("ObjList" INTEGER ARRAY); I get the following error : Could not…
Shubha Lakshmi
  • 127
  • 2
  • 2
  • 15
0
votes
1 answer

HANA Left Outer Join syntax

I am trying to build a query in HANA with a left outer join. I am using a (+) sign in the where clause. I do that often in Oracle; but in HANA it is returning a syntax error. Does HANA supports this syntax? select * FROM …
Luis Garcia
  • 1,311
  • 6
  • 19
  • 37
0
votes
1 answer

Retrieving erring procedure name , error state , severity and line number in HANA

I have a stored procedure written in T-SQL. I am trying to write equivalent procedure in HANA. I am facing some roadblocks, which are : I am not able to find equivalent of ERROR_STATE(), ERROR_SEVERITY(), ERROR_PROCEDURE(), ERROR_LINE() functions…
Shubha Lakshmi
  • 127
  • 2
  • 2
  • 15
0
votes
1 answer

How to cast expression in select clause with high performance

I have a table and want to convert a column of type decimal to an integer based on a condition. I need to do this as performant as possible. My currently working query looks like this: select *, (case when C_CUSTKEY < 20 then 1 else 0 end) as…
Jan
  • 59
  • 8
0
votes
1 answer

Add a column to SQLScript result on HANA

I am facing following issue: I had Tables A with columns: [ID, Name] B with columns: [ID, Name] Now I want to UNION those two table with the Table result C: C with columns [ID, Name, Source] The Source column in Table C will shows value "A" or "B"…
ThuanNguyen
  • 169
  • 1
  • 2
  • 13
0
votes
3 answers

SAP HANA execute query generated within a procedure

I am new with SAP HANA, I am trying to generate a query and execute it within a stored procedure. I got an error and I am not sure that HANA can do something like that. Here my code CREATE PROCEDURE "PROCEDURE_IBA_TESTCSV"( IN…
Houssem Hariz
  • 55
  • 3
  • 12
0
votes
0 answers

`FOR UPDATE` breaks batch execution in HANA

HANA 102.05 fails to execute the following code: CREATE TABLE ATABLE( f INT ); CREATE PROCEDURE TestProc() AS BEGIN SELECT f FROM ATABLE FOR UPDATE; -- Without FOR UPDATE it works END; SELECT 'Hello' FROM DUMMY; complaining that: SAP…
Anton Shepelev
  • 922
  • 9
  • 19
0
votes
1 answer

Serializing access to a table row in HANA

Whereas I am not allowed to use either identity columns or HANA sequences, I am forced manually to generate unique autoincrementing keys for tables. Here is my unsafe and naive key generation procedure, which stores unique counters in table…
Anton Shepelev
  • 922
  • 9
  • 19
0
votes
0 answers

HANA: Nested procedure calls break cursors?

When executed against HANA 102.5, the following batch CREATE PROCEDURE DUMMY( message nvarchar(254) ) AS BEGIN /* Do nothing */ END; CREATE PROCEDURE cur_test AS CURSOR cur FOR SELECT 'code' FROM DUMMY; code NVARCHAR(64); BEGIN OPEN…
Anton Shepelev
  • 922
  • 9
  • 19