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.
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.
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.
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.
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 ];
Bookmarks