Skip to Content
avatar image
Former Member

How to validate user id from USERS table in HANA

Hi Experts,

I am trying to write one store procedure in HANA with IN parameter as I_USER_ID, after receiving I_USER_ID inside Procedure, I want to validate it that coming user id is valid or not. If user is valid then I will pass "Success" message inside OUT parameter i.e O_RESULT, else "Fail" message.

Could you guys help me to do this, actually I am new in HANA stored procedure.

Regards,

HA

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jan 01, 2015 at 04:58 AM

    Hi Experts,

    I have created one Table Type (tt_user_id) and selected top one row from database table and inserted into Table type inside procedure, as below.

    CREAT TYPE TT_USER_ID AS TABLE ("User_name" nvarchar(30) );

    CREATE PROCEDURE ZSH_FINAL_PRO001( IN I_USER_ID nvarchar (30), OUT O_RESULT nvarchar (30) )

    LANGUAGE SQLSCRIPT

    SQL SECURITY INVOKER

    --DEFAULT SCHEMA <default_schema_name>

    READS SQL DATA AS           

    BEGIN

    tt_user_id = SELECT TOP 1 USER_NAME FROM USERS WHERE USER_NAME = :I_USER_ID;

    END;

    I have checked in debug mode and found 1 records inside Type tt_user_id. But I want to read/Access this first row value to verify that record found or not inside Table type TT_USER_ID. But I am not able to read first row value from TT_USER_ID. Could you please guide me how to achieve this.

    Regards,

    HS

    Add comment
    10|10000 characters needed characters exceeded