when

Multiple WHEN inside no-expression CASE in SQL?

DECLARE @TestVal int SET @TestVal = 5 SELECT CASE WHEN @TestVal <=3 THEN 'Top 3' ELSE 'Other' END I saw this sample code online but I couldn't find an example where there was no expression and it had more than one WHEN, so I am wondering if this type of thing is OK: DECLARE @TestVal int SET @TestVal = 5 SEL...

Why doesn't C# have support for first pass exception filtering?

Note: this is not a duplicate of Jeff's question. That question asked "Is an equivalent?" I know there isn't, and I want to know why! The reason I ask is that I've only just become clear on how important it is, and the conclusion seems very strange to me. The Exception Handling block of Microsoft's Enterprise Library advises us to use...

Alternative to MySQL CASE/WHEN?

I'm trying to select some integer values in MySQL. Several of the values are zero, which I want to grab as an empty string, and grab the integer values when available. So I have something like this: SELECT CASE field WHEN 0 THEN '' ELSE field, [repeat for other fields] Is there any way to shorten this in the SQL query? Does MySQL sup...

When should I ask myself if my method is thread-safe or not?

Hi, When should I take it into consideration whether my method is thread-safe or not? thanks, kalem keki ...

Ignoring a column when condition doesnt match in select query - SQL-Oracle

Hi, My requirement is to display a Column in select query when a condition satisfies and not to display the column when condition is not matched. For eg : In this simple table below Table : XYZ Name ID Fairness harish 3 White ravi 5 brown arun 2 black rahul 5 white Query: select name,case id when 5 then " I Like to learn more...

When test hanging in an infinite loop

I'm tokenising a string with XSLT 1.0 and trying to prevent empty strings from being recognised as tokens. Here's the entire function, based on XSLT Cookbook: <xsl:template name="tokenize"> <xsl:param name="string" select="''" /> <xsl:param name="delimiters" select="';#'" /> <xsl:param name="tokensplitter" select="','" /> ...

Mysql query select case when true insert

does anybody know how to do this syntax below in mysql? without Stored Procedure and in single query only SELECT CASE WHEN COUNT(v.value) = 0 THEN ( INSERT INTO tbl_v (fid, uid, VALUE) SELECT fid, 1 AS uid, 'xxxxxx' AS VALUE FROM tbl_f WHERE category = 'categoryname' AND NAME = 'somevalue' )WHEN v.value <> 'test' THEN ( 'u...

iReport - Print when expression to control whole layout or not

Hi Guys: I am in an urgent need of having the print layout thing based on the one fied condition. Let us say I have a shipment label layout with 50 fields in it and which is working. But before I print that, I have a condition saying that if Number of Packages is 0 do not print at all. Just print an error message saying that no packag...

optimizing the sql query by not repeating the math..

Here is the query in Oracle I was trying to remove the redundant math operation from: SELECT name, CASE when nvl(num1,0) + nvl(num2,0) - nvl(num3,0) > 0 THEN nvl(num1,0) + nvl(num2,0) - nvl(num3,0) ELSE 0 END as result, .... from .... How do I not repeat the summation above? The 'result...

Help with MySQL and CASE WHEN with a range of values

I have an accounts table and a records table where accounts have multiple records. I would like to break down the account totals by "count of records" range. i.e. show the breakdown of Count of Records | Count 0-25 | 100 25 - 50 | 122 50 - 100 | 300 etc. I am using the following query, but I can't get it to group by "grp" which is ...

Stuck in a Clojure loop, need some guidance

Hi, I am stuck in a Clojure loop and need help to get out. I first want to define a vector (def lawl [1 2 3 4 5]) I do (get lawl 0) And get "1" in return. Now, I want a loop that get each number in the vector, so I do: (loop [i 0] (if (< i (count lawl)) (get lawl i) (recur (inc i)))) In my mind this is supposed...

when to use MVC on PHP ?

ok i think i am pushing my self to far here, im createing a project in my own mvc even i dont know what mvc its self, <?php class init { function __construct() { $this->enviroment(); $this->start(); } function enviroment() { /* Required Classes */ ...

Why is in F# a dummy symbol literal needed between pipe and when?

Hi, I am new to F# and fiddling just around with it. What get's me is: let rec fact n = match n with | dummy when n < 2 -> 1 | _ -> n * fact (n - 1) let x = 6 printfn "%d! = %d" x (fact x) Why does F# needs this dummy placeholder between pipe and when? Dummy is even the whole time undefined and the compiler seems in some w...