Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Informix > JDBC driver support for MONTHNAME()

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-08, 11:01
andrewhallam andrewhallam is offline
Registered User
 
Join Date: Dec 2003
Posts: 28
JDBC driver support for MONTHNAME()

Just about every other DB vendor supports the MONTHNAME() SQL function but alas it seems it is not native for Informix.

e.g.
SELECT {fn MONTHNAME(orderdate)} AS month
FROM orders
gets:
Routine (monthname) can not be resolved.

Now the standard IBM ODBC driver (IBM INFORMIX ODBC DRIVER, 3.00.00.13223) does suppport this function but their JDBC driver (com.informix.jdbc.IfxDriver) doesn't.

Does anyone out there know a JDBC driver that does support this? or a work-around other than the below:

SELECT
case {fn MONTH(orderdate)}
when 1 then 'January'
when 2 then 'February'
when 3 then 'March'
when 4 then 'April'
when 5 then 'May'
when 6 then 'June'
when 7 then 'July'
when 8 then 'August'
when 9 then 'September'
when 10 then 'October'
when 11 then 'November'
when 12 then 'December'
end AS month
FROM purchaseorders

thanks in advance for any help on this.

Andy
ahmatexeldotcodotuk
Reply With Quote
  #2 (permalink)  
Old 01-18-08, 12:01
ceinma ceinma is offline
Registered User
 
Join Date: Apr 2007
Location: Distrito Federal - Brasil
Posts: 197
create function monthname ( p_dt datetime year to second) returning char(10);
define v_month char(10);



if month(p_dt)=1 then let v_month='January';
elif month(p_dt)=2 then let v_month='February';
elif month(p_dt)=3 then let v_month='March';
elif month(p_dt)=4 then let v_month='April';
elif month(p_dt)=5 then let v_month='May';
elif month(p_dt)=6 then let v_month='June';
elif month(p_dt)=7 then let v_month='July';
elif month(p_dt)=8 then let v_month='August';
elif month(p_dt)=9 then let v_month='September';
elif month(p_dt)=10 then let v_month='October';
elif month(p_dt)=11 then let v_month='November';
elif month(p_dt)=12 then let v_month='December';
end if;


return v_month;
end function
__________________
________________________________________
César Inacio Martins
Distrito Federal - Brasil
________________________________________
Reply With Quote
  #3 (permalink)  
Old 01-18-08, 12:08
andrewhallam andrewhallam is offline
Registered User
 
Join Date: Dec 2003
Posts: 28
Brilliant!
Your a star.
Thanks.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On