Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 30-07-2009
Member
 
Join Date: Apr 2009
Posts: 68
How to use SQL Case Statement Syntax

How to use the SQL Case Statement Syntax in an program, could we use the SELECT, UPDATE and DELETE statements in the application. It would be more helpful if you provide the Example along with it.
Reply With Quote
  #2  
Old 30-07-2009
Member
 
Join Date: Jan 2006
Posts: 211
Re: How to use SQL Case Statement Syntax

you are no doubt allow to use SELECT, INSERT, UPDATE, and DELETE, as well as a few functions that are useful. But it is also seen that not many people are making active use of the CASE statement, although it is one of the most useful SQL keywords in existence. There are two different types of CASE statements. The simple CASE statement takes an input value and compares it to a list of expressions to select the appropriate output value.
Reply With Quote
  #3  
Old 30-07-2009
Member
 
Join Date: Jan 2009
Posts: 143
Re: How to use SQL Case Statement Syntax

It is more efficient and better programming practice to put this logic in the database using a stored procedure or in the SQL statement so that some time i get data in "flag_cd" and sometimes i dont, and also some time i get data in "flag_id" This takes the first one the presentation of the data can be as clean and unencumbered by business logic as possible.
Reply With Quote
  #4  
Old 30-07-2009
Member
 
Join Date: Apr 2008
Posts: 193
Re: How to use SQL Case Statement Syntax

CASE statements are often found in SELECT, UPDATE and DELETE statements as well as WHERE and IN clauses. when do we uses column name, a constant, a function, a subquery, or any combination of column names, constants, and functions connected by arithmetic or bitwise operators mostly we make use of following is the Oracle syntax we are using for..

[ <<label_name>> ]
CASE { WHEN boolean_expression THEN {statement to be executed ;} ... }...
[ ELSE {statement to be displayed;}... ]
END CASE [ label_name ];
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use SQL Case Statement Syntax"
Thread Thread Starter Forum Replies Last Post
Case statement in oracle database Kingfisher Software Development 4 04-03-2010 10:21 PM
Use the CASE Statement in a SQL SELECT Clause Abraham.J Software Development 3 12-08-2009 01:52 PM
Bash case statement help on Ubuntu _Gentoo_Nile_ Operating Systems 3 29-07-2009 12:02 AM
Statement Parameter Slow in Stored Procedure case HP_Crook Software Development 3 26-06-2009 08:55 AM
SWITCH....CASE statement in C# Aadarsh Software Development 1 10-11-2008 05:39 PM


All times are GMT +5.5. The time now is 03:55 AM.