Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 query required in oracle

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-06-26 : 08:19:15
hi convert this sql server query into oracle please


--Update EMRPatientProblems
Set is_Coded=0
From EMRPatientProblems a ,
(
Select a.Patient_id, a.Location_id, c.Location_id, c.Group_id as CGroupid, d.Group_id as DGroupid,
b.Problem_id, b.Patient_id,
b.Problem_code, d.Problem_code ,
b.Problem_desc, d.Problem_desc,
b.Problem_name, d.Problem_name,
b.Is_coded
from EMRPatientProblems b
Inner Join EMRpatientsMaster a on a.Patient_id = b.Patient_id
Left Outer Join EMRLocationMaster c on a.Location_id = c.Location_id
Left Outer Join EMRUncodedProblems d on b.Problem_code = d.Problem_code
Where c.Group_id = d.Group_id and (b.Problem_code = d.Problem_code and b.Problem_desc = d.Problem_desc and b.Problem_name = d.Problem_name) and b.Is_coded=1
) b
Where a.Problem_id =b.Problem_id
--(b.Problem_code <> d.Problem_code or b.Problem_desc <> d.Problem_desc or b.Problem_name <> d.Problem_name)

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-26 : 08:23:25
Have you tried running the query in Oracle?
Which error(s) did you get?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-06-26 : 08:34:40
yes i am getting errors as
Error at Command Line:13 Column:2
Error report:
SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-26 : 10:05:30
Tyr putting "AS" before the alias names
Update		a
Set a.is_Coded = 0
From EMRPatientProblems as a
inner join (
Select a.Patient_id,
a.Location_id,
c.Location_id,
c.Group_id as CGroupid,
d.Group_id as DGroupid,
b.Problem_id,
b.Patient_id,
b.Problem_code,
d.Problem_code,
b.Problem_desc,
d.Problem_desc,
b.Problem_name,
d.Problem_name,
b.Is_coded
from EMRPatientProblems as b
Inner Join EMRpatientsMaster as a on a.Patient_id = b.Patient_id
Left Join EMRLocationMaster as c on a.Location_id = c.Location_id
and c.Group_id = d.Group_id
Left Join EMRUncodedProblems as d on b.Problem_code = d.Problem_code
and b.Problem_code = d.Problem_code
and b.Problem_desc = d.Problem_desc
and b.Problem_name = d.Problem_name
Where b.Is_coded=1
) as b on a.Problem_id =b.Problem_id



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

tfountain
Constraint Violating Yak Guru

491 Posts

Posted - 2009-06-26 : 13:15:58
I think your error is due to the derived table - PL\SQL does not recognized the syntax you chose for that. After reviewing your query, I do not see any reason for the derived table since the internal table is driven based on ERMPatientProblems. You are just adding an additional step. Rewrite the query to be less complex and eliminate the derived table.
Go to Top of Page
   

- Advertisement -