Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Create Procedure (Select and Call Procedure)

$
0
0

Hi Team,

 

I am creating a procedure that collect a select in a variable and send it to another procedure as parameter. But in the loop(FOR) I am getting some troubles, I have to set a role with a procedure in every user that will be created.

 

The procedure code is this:

 

PROCEDURE "DOUGLAS"."tmp.douglas.yahoo::testando" ( )

  LANGUAGE SQLSCRIPT

  SQL SECURITY INVOKER

  DEFAULT SCHEMA DOUGLAS

  --READS SQL DATA

  AS

BEGIN

/*****************************

procedure logic

*****************************/

declare role varchar;

declare i integer;

declare cont int default 1;

 

role = 'dux.health.model.roles::finalUser';

users =  select USER_NAME from USERS WHERE CREATE_TIME between ADD_SECONDS (CURRENT_TIMESTAMP , -7200 ) and CURRENT_TIMESTAMP;

userscount = select count (USER_NAME) from USERS WHERE CREATE_TIME between ADD_SECONDS (CURRENT_TIMESTAMP , -7200 ) and CURRENT_TIMESTAMP;

 

 

FOR i in 1..cont DO

  CALL _SYS_REPO.GRANT_ACTIVATED_ROLE(:role,users);

i := i + 1;

 

END FOR;

 

END;

 

 

 

Thank's;


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>