-->
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: create native sql query using union by createsqlquery interf
PostPosted: Thu Aug 07, 2008 9:37 am 
Newbie

Joined: Fri Jun 27, 2008 12:15 am
Posts: 5
Location: India
how form below native sql query into session.createsqlquery()

SELECT STRMEDMAST.OU_CODE, SRC_PHACODE ,
STRMEDMAST.SRD_DATE,
STRMEDMAST.SR_NO,
STRMEDMAST.SRC_SLNO,
STRMEDMAST.SRC_REQUEST ,''ch, 'Y' typ,'N' print
FROM STRMEDMAST
where nvl( STRMEDMAST.SRC_CANCEL, 'N')='N' and
nvl(STRMEDMAST.SRC_CLOSE,'N')<>'Y'
and STRMEDMAST.src_reqto='P' and SRC_PHACODE = :r_code
and 'A'= :all_a

UNION ALL

SELECT PATDRGREQMST.ou_CODE,
patient.PT_NO,
PATDRGREQMST.DRD_DATE,
patient.PT_NO,
PATDRGREQMST.DR_SLNO,
patient.PTC_PTNAME,'','N',print
FROM PATDRGREQMST, patient
WHERE ( PATDRGREQMST.PT_NO = patient.PT_NO) and
( PATDRGREQMST.BMC_SLNO IS NULL) AND
PATDRGREQMST.DRC_CANCEL IS NULL AND NVL(PATDRGREQMST.IP_NO,'N')='N' AND
PATDRGREQMST.PH_CODE = :r_code
and 'O'= :op

UNION ALL
SELECT PATDRGREQMST.ou_CODE,
IPADMISS.PT_NO,
PATDRGREQMST.DRD_DATE,
IPADMISS.PT_NO,
PATDRGREQMST.DR_SLNO,
IPADMISS.PTC_PTNAME,'','N',print
FROM PATDRGREQMST, IPADMISS
WHERE ( PATDRGREQMST.IP_NO = IPADMISS.IP_NO) and
( PATDRGREQMST.BMC_SLNO IS NULL) AND
PATDRGREQMST.DRC_CANCEL IS NULL AND PATDRGREQMST.PH_CODE = :r_code
and 'I'= :ip
and ipadmiss.ipd_disc is null
order by 2


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.