-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to use sql cursors using hibernate?
PostPosted: Mon Jan 28, 2013 2:40 pm 
Newbie

Joined: Mon Jan 28, 2013 2:21 pm
Posts: 1
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...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.