2020-09-27

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 Script. Here's a picture to show what the data looks like.

Source Data Image

Basically 'Doe, John' should be overwritten into all the empty rows until 'Doe, Jane' appears and then 'Doe, Jane' should be overwritten into empty rows until another name appears.

My idea is to store the non-empty row in a local variable, but I haven't had much success so far. Here's my code:

tempTab1 = SELECT

  CASE WHEN EMPLOYEE <> ''
    THEN lv_emp = EMPLOYEE
  ELSE EMPLOYEE
  END AS EMPLOYEE,
FROM :tempTab;


from Recent Questions - Stack Overflow https://ift.tt/333m3xv
https://ift.tt/3kRIxrg

No comments:

Post a Comment