Subject AW: [firebird-support] blank character
Author Olaf Kluge
Hello again,

The blanks were saved, but my ib-manager does not show this.

If I take a char(40)-field, the blanks were automatically saved, or not? If
the ERP-System read the table, the blanks are present. With varchar your
idea was very good, but it is easier with char. When I read the char-values
and save it in my varchar-fields (other internal table), the blanks should
not be saved.



Thank you.

Hello,

Thank you for your quick help.

The return-value is okay, but the value in the table is saved without the
blank character at the end of the string.

Here the complete procedure with a string on the end of the blank characters
- without the last code, no blanks were saved.

CREATE PROCEDURE U_VC_TO_A (
VC_IN VARCHAR (40),
STELLEN INTEGER)
RETURNS (
A_OUT VARCHAR (40))
AS/**/
declare variable blanks varchar(40) = '
';
BEGIN
A_OUT = SUBSTRING(VC_IN || BLANKS FROM 1 FOR 30);
a_out = a_out || 'test';
insert into tmp(c40) values (:a_out);
SUSPEND;
END

CREATE PROCEDURE U_VC_TO_A (

VC_IN VARCHAR (40),

STELLEN INTEGER)

RETURNS (

A_OUT VARCHAR (40))

AS

DECLARE BLANKS VARCHAR(40) = ' '; /* 40 BLANKS
LONG */

BEGIN

A_OUT = SUBSTRING(VC_IN || BLANKS FROM 1 FOR 40);

SUSPEND;

END

-----Original Message-----
From: <mailto:firebird-support%40yahoogroups.com>
firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com>

[mailto: <mailto:firebird-support%40yahoogroups.com>
firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com>
] On Behalf Of Olaf Kluge
Sent: May-08-11 12:03 PM
To: <mailto:firebird-support%40yahoogroups.com>
firebird-support@yahoogroups.com <mailto:firebird-support%40yahoogroups.com>

Subject: [firebird-support] blank character

Hello again,

our ERP-Partner need all strings in a transfertable (firebird 2.5) filled
with blank characters. Example: 'article 123' filled to the length of 20:
'article 123 '. Now I have created a little procedure:

CREATE PROCEDURE U_VC_TO_A (

VC_IN VARCHAR (40),

STELLEN INTEGER)

RETURNS (

A_OUT VARCHAR (40))

AS

BEGIN

a_out = u_pright(vc_in,' ',stellen);

insert into tmp(c40) values (:a_out); --test!

SUSPEND;

END

U_pright is a function from freeudf (u_padright). It works (test it with
adding a new string on the blank character filled), but how can I save blank
characters in the firebird-table? I have test it with char and
varchar-fields, but the blank characters were missing (EMS-IB-Manager)

Thank you very much.

Olaf.

[Non-text portions of this message have been removed]

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item on the main
(top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]