Multiple choice technology databases

The output for the qyery "select lpad('sql functions',18,'*#$') from dual;" is

  1. *#\$*#\$sql function
  2. error

  3. *#$*#sql functions
  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

lpad pads the string 'sql functions' (13 chars) on the left to reach 18 characters using pattern '#$'. The pattern repeats: '#$#$' (6 chars) + 'sql functions' (12 chars) would be 18, but we need exactly 18. The pattern '#$#' (5 chars) + 'sql functions' (13 chars) = 18 characters. Option C shows '#$*#sql functions' which is the correct padding.