Skip to Content

CONVERT SP TRANSACTION NOTIFICATION FROM SQL TO HANA COMPLIANT

Hi,

I have the below stored procedure the way I want but its in SQL format.How can I conver it to HANA compliant. Your help will be appreciated.

-------------------------------------BLOCK DUPLICATE ITEMCODES IN A DOCUMENT-------------------------------------------

IF @transaction_type IN ('A','U') AND @Object_type = '67'

Begin

If Exists(SELECT t0.DocEntry FROM WTR1 t0 where t0.DocEntry=@list_of_cols_val_tab_del GROUP BY t0.DocEntry,t0.ItemCode HAVING COUNT(t0.ItemCode)>1)

Begin

SELECT @Error = 1, @error_message = 'Duplicate rows not allow'

End

End

----------------------------------------------------------------------------------------------------------------------------------------------------------

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Sep 08 at 01:51 PM

    Hi Ernest,

    you need to put colum names between quotes since HANA is case sensitive, so e.g. t0.DocEntry in HANA would need to be t0."DocEntry". Otherwise HANA will automatically convert it to uppercase (t0.DOCENTRY) and will not find that column.

    BR,

    Matija

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 09 at 04:38 AM

    try this

    IF (:transaction_type ='A' or :transaction_type ='U' ) AND (:Object_type = '67') THEN
    Declare temp_var_0 integer;
    SELECT
    (SELECT Count (T0."ItemCode")
    FROM "WTR1" T0
    WHERE T0."DocEntry" = :list_of_cols_val_tab_del
    GROUP BY having count(T0."ItemCode">0) INTO temp_var_0 FROM DUMMY;
    IF :temp_var_0 > 0 THEN
    SELECT 10, 'Duplicate rows not allow' INTO Error, error_message FROM DUMMY;
    END IF;
    END IF;
    OR
    IF (:transaction_type ='A' or :transaction_type ='U' ) AND (:Object_type = '67') THEN
    Declare temp_var_0 integer;
    SELECT
    (SELECT Count (*)
    FROM "WTR1" T0
    WHERE T0."DocEntry" = :list_of_cols_val_tab_del
    GROUP BY having count(T0."ItemCode">0) INTO temp_var_0 FROM DUMMY;
    IF :temp_var_0 > 0 THEN
    SELECT 10, 'Duplicate rows not allow' INTO Error, error_message FROM DUMMY;
    END IF;
    END IF;

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 17 at 10:43 AM

    Dear an essay approach is to download SQL to HANA converter and use it but accuracy rate is not 100% still you have to adjusts some functions and syntex accoridng to HANA

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.