cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Problem

former_member241220
Participant
0 Kudos
83

Hi All,

I have created 2 variables

1. Test varchar(10);

2. File_change(100);

In script I have done like this

$Test = '00000049';

print( $Test );

print values is: 00000049, After I want to add 1 to this value, for that i have created script like below

$File_Change = $Test + 1;

print( $File_Change );


but i am getting print value: 50


even i tried with Concationation(||) operator


$ $File_Change = $Test || '+ ' ||1;


This time I am getting print value 00000049+1

But I want to get "00000050" Can anyone please guide me how to do this.

Thanks

Murali

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member187605
Active Contributor
0 Kudos

1. $Test int;

2. $File_Change varchar(100);

$Test = 49;

print( $Test );

$File_Change = to_char($Test + 1,'09999999');

print( $File_Change );


This will also give correct results when $Test >= 99.

former_member208402
Active Contributor
0 Kudos

Hi Murali,

Try this

$File_Change = '000000' ||$Test+1;


print($File_Change );



Thanks,

Ravi kiran.