This is the c code which has sql cursors in it. I am instructed to use sql, so I have to use createsqlquery..to create queries. The following is the sql statement that I have to use in hibernate.
There are 3 methods: 1)declares cursor and opens cursor 2) close cursor 3) fetch cursor
1) SQL to declare cursor and open cursor
EXEC SQL DECLARE Cursor_cs_indv_pgm CURSOR FOR SELECT A.PGM_TYP_CD FROM CS_PGM A ,CS_INDV_PGM B WHERE A.CS_ID =:case_id AND A.EFF_BGN_DT < F_CUR_DTM() AND NVL(A.EFF_END_DT, F_HIGH_DT()) > F_CUR_DTM() AND A.PGM_STS_CD IN (:rt_pgm_sts_pgm_sts_cd_pe, :rt_pgm_sts_pgm_sts_cd_ap) /* Added for TDR # 2065 */ AND B.CS_ID = A.CS_ID AND B.CWIN = :cwin AND B.EFF_BGN_DT < F_CUR_DTM() AND NVL(B.EFF_END_DT, F_HIGH_DT()) > F_CUR_DTM() AND B.PGM_TYP_CD = A.PGM_TYP_CD AND B.APPY_AID_SW = 'Y';
EXEC SQL OPEN Cursor_cs_indv_pgm;
2) SQL to close cursor:
EXEC SQL CLOSE Cursor_cs_indv_pgm;
3) SQL to fetch cursor: EXEC SQL FETCH Cursor_cs_indv_pgm
Let me know how to do it. What are the alternatives. How to do it...
|