|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hi!
I'm a Java programmer trying to connect to a DB2/400 database. I'm not much of an SQL programmer and I'm realling having trouble constructing my sql. Hope you could help. Is there something like an if statement in sql? What I wanted to happend is sumthing like this: SELECT idnumber FROM table WHERE ( num1 || if(num2.length() == 5) {num2 = "0" + num2;}) > '20060916123222' ORDER BY num1 ASC It says that If my num2's length is equal to five, I have to add another zero at the start of the string. I'm trying to compare strings here.... please help... ![]() |
|
#2
|
||||
|
||||
|
replace if(num2.length() == 5) {num2 = "0" + num2;} with
Code:
case when length(num2) = 5
then '0' || num2
else num2
end
|
![]() |
| Viewing: Dev Shed Forums > Databases > DB2 Development > Need SQL Help Pleas!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|