Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2005

Tip: Looking for answers? Try searching our database.

how to process NULL value record ?

Thread view: 
Belmont.O@gmail.com - 22 Jan 2005 12:56 GMT
a table "pinfo" like this:
name       age      remark
---------------------------
Jim.K      33       NULL
Harod.B    44       book publisher
Keny       22       NULL

now i want to do a query "select * from pinfo",and put result into a
jtextarea.
when using ResultSet to get records, it seems that i can only get
"Jim.K   33" and stopped reading at remark.
so how to get All records in this situation ?
Belmont.O@gmail.com - 23 Jan 2005 05:17 GMT
anyone help ?
Lee Fesperman - 23 Jan 2005 08:37 GMT
> anyone help ?

Ok, but you need to provide more information. Your terminology is imprecise -- you talk
about reading records and then refer to columns.

Please carefully describe the effects you are seeing. If you're receiving an exception,
provide all the information from the exception. And, it would be best if you posted some
code to help with your description.

Signature

Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS  (http://www.firstsql.com)

psl.stanford.edu - 24 Jan 2005 05:41 GMT
> a table "pinfo" like this:
> name       age      remark
[quoted text clipped - 8 lines]
> "Jim.K   33" and stopped reading at remark.
> so how to get All records in this situation ?

try providing more information:

1). what do u get with the statement when you use SQL*PLUS?
2). The actual code you used to retrieve records.

Jim
CD1 - 25 Jan 2005 11:33 GMT
Hi Belmon!

You can do something like this:

Statement statement = connection.createStatement();
String query = "select * from pinfo"; // your query
ResultSet rs = statement.executeQuery(query);

while (rs.next()) {
your_textarea.append(rs.getString("name") + " ");
your_textarea.append(rs.getString("age") + " ");
your_textarea.append(rs.getString("remark") == null ? "" :
rs.getString("remark") + "\n");
}

Anyway, you format it the way you want. But I think that null verifying
is useful for you. You have to put it on the fields which MAY be null,
that's why I didn't put it to name or age.. because, by your example,
name or age can't be NULL.

See ya,
Cristian Deives


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.