OK. Let us take a step backwards here.
Using echo with no quotes on it arguments is hiding any newlines, tabs, and any sequences of two or more spaces that may have been produced by the output of the db2 command. Then, since you converted all of the output from db2 into a single line with the echo, sed -n 8p
will obviously not find a number to print on the eighth line of its single line of input.
But, even before we get to that problem, you also show that the output from db2 has spaces surrounding the colons in its output. So, even if the eighth line of output was something like:
Parameter Value : 21874778112
The output when printing the 2nd field of that colon separated value line would have a leading space (which you did not show us in any message in this thread until now). That leading space will keep the assignment to dbsize from working the way you want it to work.
Making several wild assumptions, the following change shown in red might work:
dbsize=`db2 "call get_dbsize_info(?,?,?,-1)" | sed -n '8p' | awk -F ': *' '{print $2}'`
or, preferably:
dbsize="$(db2 "call get_dbsize_info(?,?,?,-1)" | sed -n 8p | awk -F ': *' '{print $2}')"
or:
dbsize="$(db2 "call get_dbsize_info(?,?,?,-1)" | sed -n '8s/.*: *//p')"
If these don't work, please show us the exact output from the command:
db2 "call get_dbsize_info(?,?,?,-1)"
so we can actually see what is on the eighth line of its output.