cancel
Showing results for 
Search instead for 
Did you mean: 

Re: cursor statement in HANA

Former Member
0 Kudos

Hi Ravi,

In our test case we are passing source schema name and target schema name from procedure as input parameter.

We need to use source schema name.tablename  in the cursor declaration as below:

begin

declare cursor c1(IN_SOURCE_SCHEMA NVARCHAR(30)) for select * from :IN_SOURCE_SCHEMA.tab2;

for i as c1(:IN_SOURCE_SCHEMA) do

----

end for;

end;

We are getting below error:

SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near ".": line 6 col 68 (at pos 192)

I used it in exec command, still it is throwing error.

Could you please suggest me how to pass schema name to the cursor declaration statement.

Regards

Kishore.

Accepted Solutions (0)

Answers (2)

Answers (2)

lbreddemann
Active Contributor
0 Kudos

Please don't "revive the dead".

Don't add new questions to an old thread that has already been closed.

Open a new question instead.

It costs the same and you get a new and fresh thread all for yourself

- Lars

p.s.

What you want to do is dynamic SQL and you cannot do this with CURSORS.

Don't try to be super-flexible here. Use schema mapping instead.

Former Member
0 Kudos

Thanks Lara. Now on wards i will raise a new thread for new questions.

Regards

Kishore.

SergioG_TX
Active Contributor
0 Kudos

in order to read a table from a schema you should follow:  "Schema"."Path.to.package::Table"