I have the following code in my program: sqlGLanalysisCode2 = "select gl_analysis_code_2 FROM gl_accounts where account_number = ? "; statGLanalysisCode2 = oconn.prepareStatement(sqlGLanalysisCode2); statGLanalysisCode2.setString(1, strGL_code); rsGLanalysisCode2 = statGLanalysisCode2.executeQuery(); I found the above code will work if I use the sybase server. However, if I use oracle, it seems to me that the ? never gets the value from the variable. Thanks for your help! Mindy
David Freels
Ranch Hand
Joined: Feb 01, 2001
Posts: 102
posted
0
I have looked at your code and compared it with some code I have written for Oracle and there should not be a problem. Maybe you should debug and check the value you are setting and make sure there is something in it. David
Mindy Wu
Ranch Hand
Joined: Jan 12, 2001
Posts: 121
posted
0
Thanks David! You are right that there is nothing wrong with my code. I do fix my problem. I found out something very different between Sybase and oracle. In oracle, if you create a field with fix length, and the field value does not take up the defined space, oracle will append white space at the end of the field value. In my sql statement, I use "=" operator, and my field value never takes up the field length, so that is why it could not return a recordset, but if I use like operator or trim the database field that fix all of the problem. Thanks! Mindy