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
1 answer

SAP HANA - Aggregate dates by ranges in SQL Script

I have this table EFF on SAP HANA: OBJECT;PN;MANUFACTURER;MONTH;QTY OBJ1;PN1;MAN1;201601;1 OBJ1;PN1;MAN1;201602;1 OBJ1;PN1;MAN1;201603;2 OBJ1;PN1;MAN1;201604;1 OBJ1;PN1;MAN1;201605;1 OBJ1;PN1;MAN1;201606;1 I would like to…
KrasshX
  • 142
  • 4
  • 20
0
votes
3 answers

Reset AUTO_INCREMENT field in SAP HANA

I'm facing an issue on SAP HANA. I created a table as : create column table some_names (ID bigint not null primary key generated by default as IDENTITY, NAME nvarchar(30)); And I inserted some values : insert into some_names (name) values…
KrasshX
  • 142
  • 4
  • 20
0
votes
0 answers

HANA Stored Procedure as Model Input Paramter

I have a requirement to create an Input Parameter for my Calculation View that defaults to the most recent Post_Date. I am using "Derived from Procedure/Scalar Function" as my Input Type. My Stored Procedure looks up the Max Post_Date but I am…
Truss120
  • 1
  • 1
0
votes
1 answer

How to convert this SQL script code to CE function in SAP HANA

I want to transfer this SQL script code to CE functions: select A.MANDT, A.ORGEH, A.ORGLV, A.S_PLANS, A.S_PERNR, b.ENAME as ENAME, (case when a.ORGLV = 'ROOT' then 'ROOT - ALL Chief' when a.S_PERNR is…
Rlearn
  • 45
  • 1
  • 5
0
votes
2 answers

Can I declare Cursor inside anonymous Block In SQLSCRIPT

Is there any way to Declare A cursor inside anonymous Block In SQLSCRIPT .
Animesh Agrawal
  • 161
  • 2
  • 16
0
votes
1 answer

How to assign current date to scalar variable?

I am trying the following syntax to assign current date to one HANA variable for further processing. I am getting an error scalar variable is not allowed DAY1 is declared as NVARCHAR(8) . DAY1 := SELECT to_nvarchar ((current_date),'YYYYMMDD')…
SQL_NOVICE
  • 35
  • 1
  • 7
0
votes
1 answer

Top-10 SAP HANA

Is it possible to create a view to list top-N or bottom-N for consumption in design studio 1.2? I have figured out the SQLScript needed to create a stored procedure to get me the same which is captured below - BEGIN select…
user2947661
  • 11
  • 1
  • 3
-1
votes
2 answers

How to convert rows to columns and find top string

Need some help to solve below. I have a table: expected result: below logic should be applied by SQL. IF "Indicator" = T1, then need to find lowest "KEY-XXX-1", Column "IN/OUT" should be converted into separate Columns and insert the dates. If…
Petras
  • 581
  • 2
  • 7
  • 17
-1
votes
1 answer

Assign value to value of a variable in SQL

I have a variable called LV_MAIN which is having value as LV_TEMP and now I want to assign value to LV_TEMP and write select for LV_TEMP. How can I achieve this? To explain in detail: LV_MAIN := LV_TEMP and now I want to assign: LV_TEMP :=…
Saurav
  • 48
  • 6
-1
votes
3 answers

SQL - Check if an item was available in the previous month and then flag it

I'm trying to solve a problem in SQL but without much success so far. I have a table like this: OWNER|STORE|DATE A | MIX |01/01/2019 A | BIX |01/01/2019 A | BIX |02/01/2019 B | CIX |01/01/2019 B | CIX |02/01/2019 It's a table showing…
Renato
  • 15
  • 1
  • 7
-1
votes
1 answer

JDBC: [337]: INTO clause not allowed for this SELECT statement

In HANA, I want to obtain the latest ID value and assign it to a variable. DECLARE MAXID BIGINT; SELECT MAX(ID) INTO MAXID FROM "SAPABAP1"."APPLOG"; But this returns an error saying; SAP DBTech JDBC: [337]: INTO clause not allowed for this…
Dumi
  • 1,414
  • 4
  • 21
  • 41
-1
votes
1 answer

HANA SQL function to split a comma delimited string into substrings

I have the following HANA Procedure: CREATE PROCEDURE SP_LIT() AS BEGIN DECLARE count INT; DECLARE pos INT; DECLARE value NVARCHAR(100); value := 'R,A'; IF LENGTH(:value) > 0 THEN value := :value + ','; pos :=…
Muskaan
  • 55
  • 2
  • 9
-1
votes
1 answer

How do I merge two procedures into one?

I am trying to merge two procedures into one. Is there any way? I am using SQL script for this. I am using eclipse for this procedures.
-1
votes
2 answers

How to use schema-mapping in a stored procedure when you have more than one schema?

I have a stored procedure on my HANA database where I need to join two tables from different schemas. These schemas are named differently in the development, staging and production system. The obvious solution in this situation would be to use…
Philipp
  • 67,764
  • 9
  • 118
  • 153
-1
votes
2 answers

"Where contains" statement with subquery

I have a problem with SQL statement like this SELECT e.id, e.name, d.name as department_id FROM (FROM (SELECT id, name, department_id FROM employee WHERE address = 'Texas' ) e JOIN department d ON e.department_id =…
Vu Le Anh
  • 708
  • 2
  • 8
  • 21
1 2 3
10
11