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

What is the fastest way to populate table with dates after certain day?

Let's assume that we have the following input parameters: date [Date] period [Integer] The task is the following: build the table which has two columns: date and dayname. So, if we have date = 2018-07-12 and period = 3 the table should look like…
Rufi
  • 2,529
  • 1
  • 20
  • 41
0
votes
1 answer

How to add tables in object privileges for a role

I am looking for a SQL command which will help me add multiple tables in object privileges for a new role in SAP HANA Studio. Currently I am adding tables for a role using following sequence. In SAP HANA Studio, I create a new role from…
Prasan Shetty
  • 49
  • 3
  • 15
0
votes
2 answers

SAP HANA : How to insert the result of stored procedure into local temporary table

I am trying to store the result of my read/write stored procedure in local temporary table. After creating the temp table i am writing - INSERT INTO #TMP call SPName; to store the result in temp table but it says feature not supported. Is there…
Prasoon Pandey
  • 99
  • 2
  • 4
  • 13
0
votes
2 answers

How to Insert Value to FUNCTION'S TABLE

My functions is here ; CREATE FUNCTION "HS_getMaasHesapla"(EmpId INT,MaasTuru VARCHAR(1),Donem VARCHAR(50),SablonCode VARCHAR(50), Maas DECIMAL(18,6),Brut DECIMAL(18,6),Pek DECIMAL(18,6),NetEkKazanc DECIMAL(18,6),BrutEkKazanc DECIMAL(18,6), …
j.doe
  • 327
  • 7
  • 22
0
votes
1 answer

How to convert MS SQL Server code into SAP HANA code?

Hello I am new in SAP HANA and I have this T-SQL code: `if(@IsBes='E')begin if((select top 1 U_bBesYontem from OHEM where empID=@EmpId)='O') begin set @Bes=@Brut*(select top 1 U_bBesOran from OHEM where…
j.doe
  • 327
  • 7
  • 22
0
votes
3 answers

Does SQLScript for SAP HANA support the use of INSERT with CTEs (Common Table Expressions)?

I know this isn't a specific bit of code or problem, but I am having trouble with a very similar issue to the person asking this (except theirs is for SQL Server): Combining INSERT INTO and WITH/CTE ...and I can't seem to find it out there on any…
jackelsey
  • 169
  • 1
  • 5
  • 17
0
votes
1 answer

Cumulative Sum grouped by multiple parameters

I need Cumulative sum for 'Order Qty'. When i use this code with Select fields as "Sales_Year","Sales_Billing_Date", "Order_Qty" am getting the result i needed. Code used: "Sales_Year", "Sales_Billing_Date", "Order_Qty" , SUM ("Order_Qty") OVER (…
0
votes
2 answers

Calculated Year in Group by

I am working on ABAP CDS view and stuck somewhere, actually i have date and amount field and i have to show sum of amount year wise, but when i run below query it didnt group by on year and show year multiple time @AbapCatalog.sqlViewName:…
Arun Gupta
  • 31
  • 2
  • 8
0
votes
2 answers

HANA SQL Syntax error

I am trying to translate some code to HANA SQL Script, however I get the following error "Incorrect syntax near 'is': line 29 col 76". The "IS NULL" seems to be an issue, however I am not sure where to place it as I am only a beginner in SQL. …
coderblogger
  • 84
  • 11
0
votes
1 answer

How to write a workdays_between function as table function in SAP HANA?

How to calculate workdays_between function for begin date and end date of a table in SAP HANA?
0
votes
2 answers

Suppress rows with reverse/swapped values

I would like to query a database table that contains rows that have reverse values than other rows. So the table looks like this Src Trgt ValueA ValueB A B 1,44 5 B …
Chris
  • 124
  • 9
0
votes
2 answers

Combining columns from two unrelated tables in SQL

Let's say I have two tables Table 1 COl_1 COl_2 1 5 2 6 3 7 4 8 AND Table 2 COL3 COL4 9 13 10 14 11 15 12 16 I want the following: COL_1 COL_2 COL3 COL4 1 5 9 13 2 6 10 …
Muskaan
  • 55
  • 2
  • 9
0
votes
1 answer

Return max by two columns within dataset?

The problem I am facing is I am trying to query SAP HANA to bring back a list of unique codes that refer to one instance of a change being made to a database. For a bit of background to the below image, each change has a relevant Site ID and Product…
jackelsey
  • 169
  • 1
  • 5
  • 17
0
votes
1 answer

Word_ext leads to syntax error in HANA stored procedures

I expect the output to be A but the invalid function name error is thrown. The syntax appears to be correct as checked on the internet. SELECT word_ext('A,B',1,',') FROM dummy
Muskaan
  • 55
  • 2
  • 9
0
votes
1 answer

Concatenation two arrays in HANA stored procedure

I try to perform Array concatenation. The code used is as shown below: --CONCATENATE TWO ARRAYS CREATEPROCEDURE"keerthi"."ARRAY_COMPLEX_CONCAT3" (OUT OUTTAB TABLE (SEQ INT,ID INT)) LANGUAGE SQLSCRIPT AS BEGIN DECLARE id1,id2,id3,id4 , id5 INTEGER…
KABIL ARASAN
  • 31
  • 1
  • 4
  • 12