dbTalk Databases Forums  

conditional selection of statements in Oracle

comp.database.oracle comp.database.oracle


Discuss conditional selection of statements in Oracle in the comp.database.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rohit Dhawan
 
Posts: n/a

Default conditional selection of statements in Oracle - 04-16-2004 , 06:43 PM






I am working on Oracle reports . One of the parameters that a User
inputs is
'report_type'. Now, is there a way to do the following within a SQL
query with no use of procedures or functions.

select blaa from foo where

something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing


Also, IS there a way of doing something like the following

// if report_type='some_data' then

select blaa from foo where
something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing

else
select blass1 from foo where
something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing

Reply With Quote
  #2  
Old   
Mark T. Stewart
 
Posts: n/a

Default Re: conditional selection of statements in Oracle - 05-08-2004 , 12:22 AM






DECODE maybe? If that's what you're driving at??

Mark Stewart
Consultants Club Corp.

rohit_reborn (AT) yahoo (DOT) com (Rohit Dhawan) wrote in message news:<c76d1c78.0404161543.461586e3 (AT) posting (DOT) google.com>...
Quote:
I am working on Oracle reports . One of the parameters that a User
inputs is
'report_type'. Now, is there a way to do the following within a SQL
query with no use of procedures or functions.

select blaa from foo where

something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing


Also, IS there a way of doing something like the following

// if report_type='some_data' then

select blaa from foo where
something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing

else
select blass1 from foo where
something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing

Reply With Quote
  #3  
Old   
R Gorden
 
Posts: n/a

Default Re: conditional selection of statements in Oracle - 05-20-2004 , 12:41 PM



If you are using Oracle9i or above, try CASE.

CASE
WHEN something THEN
do this
WHEN something else THEN
do that
ELSE
don't do anything
END

hth

stewm (AT) canada (DOT) com (Mark T. Stewart) wrote in message news:<8b8ff667.0405072122.94134a1 (AT) posting (DOT) google.com>...
Quote:
DECODE maybe? If that's what you're driving at??

Mark Stewart
Consultants Club Corp.

rohit_reborn (AT) yahoo (DOT) com (Rohit Dhawan) wrote in message news:<c76d1c78.0404161543.461586e3 (AT) posting (DOT) google.com>...
I am working on Oracle reports . One of the parameters that a User
inputs is
'report_type'. Now, is there a way to do the following within a SQL
query with no use of procedures or functions.

select blaa from foo where

something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing


Also, IS there a way of doing something like the following

// if report_type='some_data' then

select blaa from foo where
something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing

else
select blass1 from foo where
something = something
// if report_type='some_data' then
and somethingelse = something else
//else do nothing

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.