473,386 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to convert this MsSQL statement into Oracle?

I have a SQL statement that performs correctly using MS Sql (all versions), but as I'm attempting to convert it Oracle 11g, I'm having some issue where the return result says that the command is not properly ended. Yet, the subquery seems to operate correctly if I remove the update parameters.

What this sql is supposed to do is select the first 50 rows, then update each of the selected rows with specific values.

Original MS Sql version:
Update CRPDTAMX1.F55UKRQ Set CRPDTAMX1.F55UKRQ.KQZKV8='PMX', CRPDTAMX1.F55UKRQ.KQZKV9 ='PMX', CRPDTAMX1.F55UKRQ.KQZKSTS ='Submit', CRPDTAMX1.F55UKRQ.KQZKCDE ='1' FROM (Select TOP 50 * From CRPDTAMX1.F55UKRQ Where (((CRPDTAMX1.F55UKRQ.KQZKV9 ='' or CRPDTAMX1.F55UKRQ.KQZKV9 ='0' Or CRPDTAMX1.F55UKRQ.KQZKV9 Is Null) Or (CRPDTAMX1.F55UKRQ.KQZKV8 ='' And CRPDTAMX1.F55UKRQ.KQZKV9 ='PMX') Or (CRPDTAMX1.F55UKRQ.KQZKV8 ='PMX' And CRPDTAMX1.F55UKRQ.KQZKV9 ='PMX')) And (CRPDTAMX1.F55UKRQ.KQZKSTS ='Ready' Or CRPDTAMX1.F55UKRQ.KQZKSTS ='Active')) And KQACTI <> 'R' Order by CRPDTAMX1.F55UKRQ.KQZKCDE, CRPDTAMX1.F55UKRQ.KQZKID) AS KQ Where CRPDTAMX1.F55UKRQ.KQZKID= KQ.KQZKID

Oracle converted version:
UPDATE CRPDTAMX1.F55UKRQ A
Set A.KQZKV8='PMX', A.KQZKV9 ='PMX', A.KQZKSTS ='Submit', A.KQZKCDE ='1'
From (Select *
From CRPDTAMX1.F55UKRQ C
Where (((C.KQZKV9 ='' or C.KQZKV9 ='0' Or C.KQZKV9 Is Null) Or (C.KQZKV8 ='' And C.KQZKV9 ='PMX') Or (C.KQZKV8 ='PMX' And C.KQZKV9 ='PMX')) And (C.KQZKSTS ='Ready' Or C.KQZKSTS ='Active')) And KQACTI <> 'R' and ROWNUM <=50
Order by C.KQZKCDE, C.KQZKID) B
Where A.KQZKID=B.KQZKID;

What I'm getting from the Oracle db is the following:
[Oracle][ODBC][Ora]ORA-00933 Sql command not properly ended

Any help would be greatly appreciated! Thanks in advance for your help!
Jan 26 '11 #1
1 1591
amitpatel66
2,367 Expert 2GB
Its becuase of incorrect syntax. You need to use something like this:

Expand|Select|Wrap|Line Numbers
  1. UPDATE CRPDTAMX1.F55UKRQ A
  2. Set A.KQZKV8='PMX', A.KQZKV9 ='PMX', A.KQZKSTS ='Submit', A.KQZKCDE ='1'
  3. Where EXISTS (SELECT 1 FROM CRPDTAMX1.F55UKRQ C 
  4.  WHERE A.KQZKID=B.KQZKID)
  5. /
  6.  
You can add all your conditions for table CRPDTAMX1.F55UKRQ in the above query
Jan 27 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: simianphile | last post by:
OK, I had a problem that I've now fixed but I can't really understand what was causing it in the first place. I have an intranet site that uses basic authentication to allow users to view and...
2
by: Cherrish Vaidiyan | last post by:
Hello all, A warm Xmas greetings to all. I have a small problem with starting up the database. Here my strategy. I have installed Oracle 9i R 2 on Red Hat 9. i created two database on this...
2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
1
by: H. Kaya | last post by:
Hallo, I have a problem converting a XML file to a other. I have no idea how I can do this. I try it for a long time but I can not find a solution. Has anyone a Idea? Below you can find my...
5
by: dnsstaiger | last post by:
I try to accomplish the following: I have two tables which are connected via a third table (N:N relationship): Table 1 "Locations" LocationID (Primary Key) Table 2 "Specialists"...
1
by: Mullin Yu | last post by:
hi, i'm using System.Data.OracleClient; but it seems not having Varchar2 and i use Varchar instead. Then when i call a Oracle Procedure update a table with varchar2, i got the following error: ...
3
by: Budd | last post by:
I don't know how to connect to oracle database by asp.net Anyone have any simple or step for me to connect?? i have no idea.... i have search from google and get the code But it seen i have miss...
2
by: TheLongshot | last post by:
Ok, let's try this again. I have an ASP.NET 1.1 application that I'm working to convert to 2.0, but I've run into a snag. The problem is with this line: return...
1
by: dsuniln | last post by:
I have two oracle clients installed on a windows 2003 Server.Namely oracle 8i client and oracle 9i client. The problem is that I have two applications running in IIS. One application creates an...
0
by: alok | last post by:
i having problem in oracle 9i dataBase------ i want to convert my oracle data to sql 2000.....but i cant convert the hindi data from oracle to sql 2000... means...... i having table in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.