‎2008 May 02 10:42 AM
wat is the correct syntax for open cursor?do anyone provide sample code for it?
‎2008 May 02 10:45 AM
Hi,
DATA: C1 TYPE CURSOR.
OPEN CURSOR C1 FOR
SELECT * FROM SFLIGHT WHERE CARRID = 'LH '.http://www.sapdb.org/7.4/htmhelp/7b/0bdea252d746429420007a69bd06c7/content.htm
http://help.sap.com/saphelp_47x200/helpdata/en/f5/cbbd9f39694aa1b76759b6c801b4a1/frameset.htm
‎2008 May 02 10:48 AM
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.
‎2008 May 02 10:47 AM
hi
check this
<declare_cursor_statement> ::= DECLARE <result_table_name> CURSOR FOR <select_statement>
reward if helpfull
thanks and regards
snehi chouhan
‎2008 May 02 10:50 AM
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