What I have done in the past for something like this is built my SQL inside a variable within the SP and once built I then used an execute immediate to run the built SQL. That enabled me to use if/else or whatever else logic to build the SQL. Probably some other ways, keep thinking you could do it with manipulation via decode but not picturing how to do it in my head right now.
On Tue, May 20, 2008 at 2:42 PM, Bill Mohr <[EMAIL PROTECTED]> wrote: > > I'm messing with a stored procedure select query. Need a condition in > the where clause based on the variable 'rectype' - if rectype=1, then > select only records where rec_type = 1, if rectype=2, then select only > records where rec_type = 2, but if rectype=3 then select only records > where rec_type <> 1. > > tried a switch case or if - then - else, but errors on syntax and I > need help: > > something like this? > > BEGIN > SELECT foo_variable1 > INTO foo_variable1 > FROM foo_table > WHERE > foo_id = fooid > and > fy = FY_IN > and > if > rectype < 3 then rec_type = rectype; > else rec_type <> 1; > end if; > END; > > > -- Aaron Rouse http://www.happyhacker.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Houston ColdFusion Users' Group" discussion list. To unsubscribe, send email to [EMAIL PROTECTED] For more options, visit http://groups.google.com/group/houcfug?hl=en -~----------~----~----~----~------~----~------~--~---
