Here’s what the expression does and how to fix it.
What it builds
- chr(64) = @
- chr(52) = 4
- chr(51) = 3
- chr(55) = 7
- chr(48) = 0
- chr(49) = 1
So the left part forms "@43701", then it inserts the current user, then "@10734" from the right part. The result looks like:
- "@43701
@10734" If the current Oracle user is SCOTT, you’d get "@43701SCOTT@10734".
Syntax issues in your snippet
- Oracle’s CONCAT function takes exactly two arguments. Your expression uses many concatenations with || but wraps them in a single CONCAT call, which is incorrect, and there’s a missing closing parenthesis.
- Also, USER (uppercase) is the pseudocolumn that returns the current user; using user (case-insensitive) is fine in Oracle, but typically you’d write USER.
Fixed, simple versions
Option 1: Use only concatenation SELECT chr(64)||chr(52)||chr(51)||chr(55)||chr(48)||chr(49)||USER||chr(64)||chr(49)||chr(48)||chr(55)||chr(51)||chr(52) AS result FROM dual;
Option 2: Use literal segments (more readable) SELECT '@43701' || USER || '@10734' AS result FROM dual;
If you want to continue using the CHR approach, you can nest CONCAT, but it’s unnecessarily verbose.
If you want, tell me the current user you’re expecting and I’ll show a concrete example.