Query substr

Can someone explain what this line below is accomplishing. I am fairly new to PLSQL.  

substr(max((lpad(percent,10,'0') | | line_num)),11,6)
Medicine1Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sdstuberConnect With a Mentor Commented:
assuming percent and line_num are columns in a table it's something like this.

given a percent like 17, pad it with zeroes out to 10 characters.

0000000017
then append the line_num column to it.  so if Line_num is 8 then you'll get a string

00000000178

do that for every column and find the maximum value of all of them.
so

000001689156 will be greate than 00000000178


then with that maxium value (in this case 000001689156)  start with the 11th charcter and read
forward 6 characters (or until you run out of characters) and return that.

so...  given 000001689156
that would return "6"

if you had 0000123456987654321  you would get 987654





0
 
Medicine1Author Commented:
Is the | | (bars) combining the numbers?
0
 
sdstuberCommented:
yes, that's the string concatenation symbol
0
All Courses

From novice to tech pro — start learning today.