Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: MSSQL Case equiv in Oracle (8.1.7.2.0)
James wrote:
> Hi all,
>
> I am trying to port the query below from an MSSQL 2000 server to an
> ORACLE 8.1.7.2.0 server. I assume i need to use the DECODE command but
> i just cant seem to get it working... any help would be great!
>
> <code start>
> SELECT priority = CASE WHEN priority = '04-Medium' AND severity = '99'
> THEN 'URGENT'
> ELSE priority
> END
> FROM table_case
> <code end>
I hope those <start> and <stop> messages are not in your code.
The syntax you want is:
SELECT CASE WHEN ....
INTO priority
FROM ...
WHERE ...
This is Oracle, not SQL Server, and you can not use the same syntax. No
where in Oracle can you use your SELECT <variable> = syntax. And even if
you could ... it would be := not = for an assignment.
I'd suggest you take advantage of the numerous on-line resources available such as:
http://tahiti.oracle.com http://otn.oracle.com http://www.asktom.oracle.com http://www.psoug.org
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Sun Jan 18 2004 - 17:46:08 CST