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

Error in Cursors

$
0
0

Hi all,

     I am trying to fetch data from a cursor but am getting errors. I tried using 4 ways but it failed all the times. Not sure what I am doing wrong here.

 

 

DECLARE

 

CURSOR cur_source_data........;

 

CURSOR cur_sms_plan(t_fan_no VARCHAR(22), t_ban_no VARCHAR(20), t_wan_no VARCHAR(10)) FOR

           SELECT "F_C",  "F_D", "F_C/C"

                           FROM TABLE_NAME

                                         WHERE "F_A_No" = t_fan_no

                             AND "B_A_No" = t_ban_no    

                        AND "W_No" = t_wan_no;

 

 

BEGIN

 

FOR v_dest_data AS cur_source_data DO

 

INSERT INTO TABLE  VALUES(-----------);

 

 

--CASE I - Throwing an error - could not create catalog objects: invalid identifier

 

OPEN cur_sms_plan(v_dest_data.F_A_No, v_dest_data.B_A_No, v_dest_data.W_No);

FETCH cur_sms_plan INTO sms_plan_code, feat_desc, feat_cc;

  LOOP

  sms_plan_name := sms_plan_name || feat_desc || ','  ;   --picking one attribute and concatenating it with itself to form a string

END LOOP;

 

--CASE II - (adding quotes around the column name) error - Invalid Cursor Parameter

 

OPEN cur_sms_plan(v_dest_data."F_A_No", v_dest_data."B_A_No", v_dest_data."W_No");

FETCH cur_sms_plan INTO sms_plan_code, feat_desc, feat_cc;

  LOOP

  sms_plan_name := sms_plan_name || feat_desc || ','  ;   --picking one attribute and concatenating it with itself to form a string

END LOOP;

 

--CASE III - throwing error _ Could not create catalog object: feature not supported

FOR rec_abc AS cur_sms_plan(v_dest_data."F_A_No", v_dest_data."B_A_No", v_dest_data."W_No" )

DO

temp_sms_plan_name := temp_sms_plan_name || rec_abc."F_D" || ',' ;

END FOR;

 

 

--CASE III - throwing error _ could not create catalog objects: invalid identifier

FOR rec_abc AS cur_sms_plan(v_dest_data.F_A_No, v_dest_data.B_A_No, v_dest_data.W_No)

DO

temp_sms_plan_name := temp_sms_plan_name || rec_abc."F_D" || ',' ;

END FOR;

 

 

 

END FOR;


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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