Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: table variables as inner call parameters for cursors

$
0
0

Hello Christian

 

Answer to your first question - in bold below

 

PROCEDURE "AADI"."aadi.test.load::sample" ( )

  LANGUAGE SQLSCRIPT

  SQL SECURITY INVOKER

  --DEFAULT SCHEMA <default_schema_name>

  READS SQL DATA AS

BEGIN

 

  tblvar_res = CE_COLUMN_TABLE("AADI"."TESTTABLE",[ "RESOURCE_ID","RESOURCE_TYPE"]);

 

 

BEGIN --it is illegal to write a DECLARE any where except immediately after BEGIN

  DECLARE CURSOR c1 FOR SELECT * FROM :tblvar_res;

  OPEN  c1;

     -- write some logic here

  CLOSE c1;

  END;

 

END;

 

Answer to your second question:  a table type that matches the Column table, in the case of the example above it is

Create type tt_res AS TABLE (

RESOURCE_ID VARCHAR(256),

RESOURCE_TYPE VARCHAR(256)

);

 

Also when you need to refer to the value of the table variable you need to use the notation :<tablevariable> (in italics above)

 

Warm regards

aadi


Viewing all articles
Browse latest Browse all 9165

Trending Articles



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