Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

declare cursor on local temporary table

Hello Experts,

i am  creating a procedure where in i build my source data first and feed it in a LTT . after feeding it to LTT i need to iterate on the data hence i need to use LTT in cursor select statement. in the beginning while declaring cursors i was getting syntax errors which resolved completely when i moved the same declare cursor statement jsut before to CREATE LTT statement (wiered) like below


decare var1 varchar(2);

declare cursor c1 for select ........;

create local temporary table ltt1 (........);

PROBLEM:- now as i need to use the LTT in my cursor select statement , if i declare the cursor before LTT create statment i get the error "cannot use the LTT table "table_name" which is obvious and if i give the same declare cursor statement post to my LTT create statement i get invalid syntax error at the Declare cursor statement......

can anyone suggest please if i can use LTT somehow in my cursor and also why procedure does n't let me  declare my cursor after the create statement !!

thanks for knowledge sharing....:)

Former Member
Not what you were looking for? View more on this topic or Ask a question