aiaiDBA

加微信获取免费职业规划+学习资料,了解年薪50万的DBA是如何练成的

13718043309

010-86462881

PCB-00557: USING clause can only be used on a PREPAREd dynamic statement

PCB-00557: USING clause can only be used on a PREPAREd dynamic statement
Cause: A severe semantics error occurred because the USING clause was used with the OPEN cursor statement and the cursor declaration is not for a PREPAREd statement. The correct sequence of statements should be like: EXEC SQL prepare sv from :sel_stmt END-EXEC. EXEC SQL declare csv cursor for sv END-EXEC. EXEC SQL open csv USING :hv1, :hv2 END-EXEC.
Action: Use the prepare statement for the sql statement and use that in the declare cursor statement.

请先 登录 后评论

1 个回答

小智
PCB-00557:USING子句只能在PREPAREd动态语句中使用,
.原因:发生严重的语义错误,因为USING子句与OPEN游标语句一起使用,游标声明不适用于PREPAREd语句。正确的语句序列应该如下:EXEC SQL prepare sv from:sel_stmt END-EXEC。EXEC SQL声明sv END-EXEC的csv游标。EXEC SQL打开csv使用:hv1,:hv2 END-EXEC。,
.操作:对sql语句使用prepare语句,并在declare cursor语句中使用它。,
.
请先 登录 后评论