Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: pb sqlserver to oracle

Re: pb sqlserver to oracle

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Thu, 30 Jan 2003 11:50:20 +0000
Message-ID: <b1ashe$arn$1@ctb-nnrp2.saix.net>


slashes wrote:

> I'm newbie in Oracle and I'd would like to transform my SQL Server
> statement to Oracle statement.

First thing to do is to repeat the following magic mantra.

Transact-SQL is not Oracle SQL.

Repeat several times until you're struck with the deeper meaning of this mantra and illuminated by your understanding of it.

> I don't know how transform my SQl
> statement (oracle gives errors).

Refer to the mantra.

> Here is my code:
> IF((select count(*) from Acteurs) != 0)
> BEGIN
> select ...
> union
> select ...
> END
> ELSE
> BEGIN
> select ...
> END
There are likely various crafty and cunning ways to solve this in Oracle. But I will not deby you the pleasure of learning about Oracle SQL and PL/SQL. Or reading the Oracle SQL and PL/SQL manuals.

Oracle SQL does not allow PL/SQL statement to be mixed with it. In Transact-SQL, you can do that to your hearts content. OTOH, PL/SQL is a full blown formal programming language that by exceeds the abilities of Transact-SQL.

One way to deal with the above, is to make it into a reference cursor (PL/SQL function that does the check, creates a cursor, and returns the handle).

Or you could re-look at what the business requirement is that resulted in this wonderful weirdly Transact-SQL statement and then decide what wonderful weirdly Oracle statement best can service this requirement.

--
Billy
Received on Thu Jan 30 2003 - 05:50:20 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US