Problems to refill columns with LPAD and RPAD
Posted in 2012
Topics: Data Types & Schema Design, Java & JDBC Development
Hello estimated people of the forum. I have the following problem: I need to generate a flat file of 369 characters that correspond to 34 columns of different tables of my base. Since I use an engine 7.31 TD6 on Windows 2000 Server, I do not have the option of the LVARCHAR. I faced the solution across Java, crossing a ResultSet, but the Stored Procedure who returns the information, in some columns (those that come with value null) does not return the quantity of blanks that I add with RPAD or with LPAD for the case of the numbers. I will be grateful if someone can give me the solution to this problem. Gustavo Echenique
Version 7.31 does support basic CHAR types which can be up to 32765 bytes long, so the type returned from the SPL procedure should not be a problem, just declare it to return a CHAR(369). As far as padding NULL values to a string of blanks, since 7.31 does not support either the CASE...END CASE clause in queries your only option is to manually convert the data in the procedure, thus: if (some_int_column_var IS NULL) then LET some_int_column_string = ' '; else LET some_int_column_string = LPAD( some_int_column_var, 10); end if ... LET result_string = ..... || some_int_column_string || ....; Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Tue, Sep 25, 2012 at 10:52 AM, GUSTAVO ECHENIQUE < gustavo.echenique@cemdo.com.ar> wrote: > Hello estimated people of the forum. I have the following problem: I need > to > generate a flat file of 369 characters that correspond to 34 columns of > different tables of my base. Since I use an engine 7.31 TD6 on Windows 2000 > Server, I do not have the option of the LVARCHAR. > > I faced the solution across Java, crossing a ResultSet, but the Stored > Procedure who returns the information, in some columns (those that come > with > value null) does not return the quantity of blanks that I add with RPAD or > with LPAD for the case of the numbers. > > I will be grateful if someone can give me the solution to this problem. > Gustavo Echenique > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --e89a8f3ba95b5a99ea04ca8873de