'Jean-Michel OLTRA' wrote:
>
>
> Le lundi 16 f�vrier 2004, Zabach, Elke a �crit...
> bonjour,
>
>
> > > sqlcli TROUPEAU=> SELECT CHR(NUM('1')+1) FROM DUAL
> > NUM(number) is of no use.
> > Try CHR ( FLOAT(1, n) + 1) FROM DUAL
> > with n being a number between 1 and 38 according to your needs.
>
> The value is string, picked with SUBSTR from a key whose format is
> NNNN-seqNumber.
> And I would like to increment, if necessary, seqNumber. So I must
> convert the char '1' (as an example, it could be '19'), to number 1,
> within a dbproc, if possible, to get a 'computed' new key.
> If not, Python will compute the key.
>
Sorry, I misunderstood what you wanted.
Let's try:
substr(oldkey, 5) is the old seqNumber as char
num(substr(oldkey, 5)) is the old seqNumber as number, but
unfortunately float
fixed (num(substr(oldkey, 5)), n, 0) is the old seqNumber as number, now as
integer with n digits
fixed (num(substr(oldkey, 5)) + 1, n, 0) is the new seqNumber as number, as
integer with n digits
now it depends, if the seq_Number has to have leading '0' within the new key or not
substr(oldkey, 1, 4) ||
lfill (ltrim(chr(fixed (num(substr(oldkey, 5)) + 1, n, 0))) , '0', 7) should
result in a 11-char new-key
with leading '0' in seqNumber (assuming n is not > 7)
And this you want to do in a dbproc or (with version 7.5.1) in a user defined function?
Elke
SAP Labs Berlin
> --
> jm
>
>
> --
> MaxDB Discussion Mailing List
> For list archives: http://lists.mysql.com/maxdb
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
>
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]