QuestionQ62

VerifiedUsing Single-Row Functions to Customize Output

Evaluate the SQL statement:

SELECT LPAD (salary, 10, *)  
  
FROM EMP -  
WHERE EMP_ID = 1001;  

If the employee whose EMP_ID is 1001 has a salary of 17000, what is displayed?

Explanation

Oracle LPAD uses its third argument as a text expression containing the padding characters, such as '*'. An unquoted * is not a string literal, so the statement is invalid and produces an error rather than a padded salary value. The trailing hyphen after EMP also prevents the displayed SQL from being valid.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!