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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SELECT statement issue

Re: SELECT statement issue

From: Ganesh Raja <ganesh.raja_at_gmail.com>
Date: Sat, 16 Sep 2006 09:35:13 +0200
Message-ID: <f754edf0609160035o5634e149j5ebc1a62e1912b8c@mail.gmail.com>


Only If the Values are Part of the Table !!!! If Not he needs a PL/SQL Function Returning a Table Type and then He can Select from that Table Type....

My few cents ... :)

Cheers

On 9/16/06, Mark Brinsmead <pythianbrinsmead_at_gmail.com> wrote:
>
> When "porting" from SQL Server to Oracle (or many other combinations, for
> that matter) you need to recognise that you are changing much more
> than "just" the database. Frequently large parts of the application may
> need to be replaced -- or even redesigned.
>
> This particular construct might be perfectly natural with SQLserver, but
> it definitely is not with Oracle -- as you have already noticed, it is not
> valid
> Oracle SQL. The following construct, while looking rather "unusual" MIGHT
> do what you want:
>
> SELECT ...
> WHERE ...
> AND values = 'xyz'
> UNION ALL
> SELECT ...
> WHERE ...
> AND values <> 'xyz';
>
> With this, like almost everything else you will face while "porting" from
> one database to another, you may want to think twice about what you are
> really trying to achieve an how you should actually best go about doing
> it...
>
>
> On 9/14/06, Harvinder Singh < Harvinder.Singh_at_metratech.com> wrote:
>
> > Hi,
> >
> >
> >
> > We are porting the application from SQL Server to Oracle, we have lot of
> > queries in the xml file and the application read the queries from the file.
> >
> > In some scenarios we have following construct in sql server where we are
> > checking the value and depending upon it running one of the 2 sql's:
> >
> > If (values = 'xyz')
> >
> > Begin
> >
> > Select….
> >
> > End
> >
> > Else
> >
> > begin
> >
> > Select…..
> >
> > End
> >
> >
> >
> > Oracle somehow don't like this construct and giving error : ORA-00900:
> > invalid SQL statement
> >
> >
> >
> > What is the way to port this to oracle?
> >
> >
> >
> > Thanks
> >
> > --Harvinder
> >
> >
> >
>
>
>
> --
> Cheers,
> -- Mark Brinsmead
> Staff DBA,
> The Pythian Group
> http://www.pythian.com/blogs
>

-- 
-----------------------------------------------------------
http://iyertalks.blogspot.com/

--
http://www.freelists.org/webpage/oracle-l
Received on Sat Sep 16 2006 - 02:35:13 CDT

Original text of this message

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