Name

make_string, make_bin_string, make_wstring — make a string of the requested type and length

Synopsis

make_string( in count integer);
 
make_bin_string( in count integer,
  in pattern varchar);
 
make_wstring( in count integer,
  in pattern nvarchar);
 

Description

make_string returns a new varchar of length count, filled with binary zeros. If count is zero, an empty string '' is returned.

make_bin_string returns a new varbinary value of length count. The optional pattern string is repeated to fill the result; without a pattern the result is filled with binary zeros.

make_wstring returns a new nvarchar (wide string) of count wide characters. The optional pattern wide string is repeated to fill the result; without a pattern the result is filled with binary zeros.

Parameters

count

Length of the string to be generated.

Return Values

A string with defined length is returned.

Examples

Example 24.232.  Using make_string and aref

Make a string and fill it with character sequence containing the alphabet upper case characters from A to Z.

SQL> create procedure
alphabet_string ()
{
  declare _inx integer;
  declare _str varchar;
  _str := make_string (26);

  while (_inx < 26)
    {
      aset (_str, _inx, _inx + 65);
      _inx := _inx + 1;
    }
  return (_str);
}
;

Done. -- 6 msec.
SQL> select alphabet_string ();
callret
VARCHAR NOT NULL
_______________________________________________________________________________

ABCDEFGHIJKLMNOPQRSTUVWXYZ

1 Rows. -- 4 msec.
      

See Also

vector(), aref, aset


© 1992 - OpenLink Software. All rights reserved.

Making Technology Work for You®