Take a look at the JDBC API specification, which discusses the behavior of
getInt() and associated methods. Consider that there is no way for an int
primitive to have a blank (i.e. null) value.

You can use getObject() instead, which will return a java.lang.Integer
(probably, but it depends a bit on the driver) if there is an actual value,
and null if there isn't. Alternately, you can call the wasNull() method to
see if the last value read was null.

There are a number of good JDBC tutorials on the web and in various servlet
books.


At 11:47 AM 8/3/2000 -0700, you wrote:
>When I do the following:
>
>SQL> select ftrnr from scars.str where strnr=45678;
>
>I got:
>
>FTRNR
>----------
>
>which is correct.  FTRNR column has no value.
>
>FTRNR column in the database table is defined as NUMBER(6)
>
>However, when I am writing the code to retrieve the value of FTRNR I always
>get a "0" value.
>This is false; the value should be blank.  How do I fix this problem?
>Because for some
>FTRNR, the value in the database is actually "0" and not blank.
>
>Ps:  I am having this problem because in my code I also have to make a
>decision to display the
>        FTRNR in the report.  And some value of FTRNR is "0" and others are
>blank or null.
>
>Here is my code:
>
>
>       String sel_ftrnr = "SELECT ftrnr from scars.str where strnr=45678;
>       rs = stmt.executeQuery(sel_ftrnr);
>       while(rs.next()) {
>          int ftrnr_value = rs.getInt("ftrnr");
>       }
>
>
>Thank you for your help in advance.
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

---
William Crawford                                        + 01 617 577 7844
Invantage, Inc                                            [EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to