Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OPEN CURSOR STATEMENT

Former Member
0 Likes
727

wat is the correct syntax for open cursor?do anyone provide sample code for it?

4 REPLIES 4
Read only

Former Member
Read only

0 Likes
664

but i m getting runtime error for this code

EXEC SQL.

OPEN CURSOR dbcur FOR

SELECT part,

revi,

part_pl

FROM DB2PP. F0CBTAD

WHERE part = :p_part.

IF sy-subrc NE 0.

WRITE:/ ‘error’.

EXIT.

ENDIF.

ENDEXEC.

Read only

Former Member
0 Likes
664

hi

check this

<declare_cursor_statement> ::= DECLARE <result_table_name> CURSOR FOR <select_statement>

reward if helpfull

thanks and regards

snehi chouhan

Read only

Former Member
0 Likes
664

OPEN CURSOR

Opens a database cursor.

Syntax

OPEN CURSOR WITH HOLD c FOR SELECT result

FROM source

WHERE condition

GROUP BY fields

HAVING cond

ORDER BY fields.

Opens a cursor c with type CURSOR for a SELECT statement. All of the clauses of the

SELECT statement apart from the INTO clause can be used. The INTO clause is set in the

FETCH statement. If you use the WITH HOLD addition, the cursor is not closed when a database

commit occurs.

You are not closing the threads even if you have got answers to them. Hence please amke sure that you are closing threads if you have got the answers by awarding points.

Thanks,

Vibha