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

SQL View with table variables

Is it possible to create a view and that view to contain table variables for example like this: create view "USERS_VIEW" as tt = select * from "UsersTable" where "UserID" in (128,129); select * from :tt with READ ONLY;
john
  • 796
  • 1
  • 13
  • 34
0
votes
1 answer

How to establish read-only-once implement within SAP HANA?

Context: I am a long-time MSSQL developer... What I would like to know is how to implement a read-only-once select from SAP HANA. High-level pseudo-code: Collect request via db proc (query) Call API with request Store results of the request…
Adam Cox
  • 3,341
  • 1
  • 36
  • 46
0
votes
2 answers

SAP HANA Calculation View with Calculated Column with SQL Script

I have created a CV just like this "Former Member" on this blog https://blogs.sap.com/2017/05/18/factory-calendar-transpose-in-sap-hana-studio-step-by-step/ It works like a charm! My next requirement is to take that DATE_SAP for each record and…
0
votes
2 answers

Save value in local variable HANA SQL Script

I'm trying to take value from a non-empty row and overwrite it in the subsequent rows until another non-empty row appears and then write that in the subsequent rows. Coming from ABAP Background, I'm not sure how to accomplish this in HANA SQL…
0
votes
2 answers

HANA - Procedure to activate/ deactivate a specific database user

I'm trying to develop a procedure in HANA that activates and deactivates a special database user and logs everything in this regard. I like that the user always has the same initial password after activation - but is forced to change it when he logs…
Toni
  • 1
  • 1
0
votes
0 answers

How do you duplicate open documents in every month until they are closed when they have no data in some months?

I have been trying to solve the below case on SQL to take it to crystal reports so I can create a dynamic crosstab with the data. Basically I have the below set of data This shows 1 Order going through different phases, each phase has a date and…
0
votes
1 answer

How to overcome grouping() function not supported by HANA Table UDF?

I have written some custom logic in HANA anonymous block. I used grouping function somewhere in the middle as a core. It worked well and the result was satisfying. Once I tried to industrialize it by moving to HANA Table Function, the activation…
wounky
  • 97
  • 1
  • 12
0
votes
1 answer

Looping over HANA table

I'm trying to create a stored procedure in HANA that should loop through a table. Lets say I have 3 columns, ColumnA, ColumnB and ColumnC. In ColumnA, I have my identifiers that I would like to loop over. In ColumnB, I have related identifiers, but…
Jae
  • 49
  • 1
  • 8
0
votes
1 answer

Error when trying to call SAP HANA stored procedure from service side

I am trying to call a SAP HANA hdbprocedure from my service side using below code. var con = ConLib.getHDBConnection(); var uploadStmt = con.loadProcedure("_SYS_BIC" , "procname"); var result = uploadStmt("samplefield1", "samplefield2",…
user1203259
  • 95
  • 1
  • 6
0
votes
1 answer

Why Does HANA Table Name Have A "/"?

There are a few things I've needed to get used to in using HANA SQL. Like using all upper case, but what I really don't understand is why "/" is necessary. Because of the "/" I must enclose the table name in "..." (double…
user69355
  • 99
  • 7
0
votes
1 answer

SAP HANA SQL to compare line-items

QUESTION: How can I find Materials within Document Number's which match at least by X-Percentage (e.g. >=50%), in other Document Number's? CREATE TABLE: CREATE COLUMN TABLE "SCHEMA"."MYTABLE" ( "DOCUMENT" NVARCHAR(10) DEFAULT '' NOT NULL , …
Robin P.
  • 3
  • 3
0
votes
1 answer

Any way to cast a table with one value as a scalar type? (Integer, String, etc.)

Here is what I would like to do: declare maxNum integer; maxNum = select MAX(rn) from :ColumnList; The sql statement returns a table with one row/col (one value). Is there an easy way to assign this value to a scalar variable?
ThomasRones
  • 657
  • 8
  • 29
0
votes
1 answer

while loop is ending to early in SAP Hana Sql Procedure

I have the following SQL-Script: PROCEDURE "P_OVERVIEW" () LANGUAGE SQLSCRIPT READS SQL DATA AS BEGIN DECLARE I INT = 0; WHILE :I < 24 DO SELECT A, B, COUNT(A) AS COUNT, LAST_DAY(ADD_MONTHS(CURRENT_TIMESTAMP, -:I)) AS "DATE", I FROM…
lisa
  • 107
  • 5
  • 12
0
votes
2 answers

How to import table from PostgreSQL to SAP Hana?

I'm trying to export data from PostgreSQL and import it into SAP Hana. The problem which is '\n' i.e. line breaks are getting automatically removed from the TEXT data. Example: A 1,750 word essay is 11 to 12 paragraphs. A 2,000 word essay is 13 to…
0
votes
2 answers

Input Parameter filtering with empty value

I want to display all the data when the input parameter is left empty. I am able to make it work with the following code in the filter expression in the calculation view. However, when I pass a value in the input parameter, it does not…
Boy12343
  • 75
  • 3
  • 10