SELECT employee_id FROM employee where employee_name='SMITH';
Output is 76123
How to write a query in Oracle to print the output as follows
'v123%'
CodePudding user response:
Using concatenation is one option.
SQL> select chr(39) || '%' || empno || '%' ||chr(39) as result
2 from emp
3 where rownum = 1;
RESULT
--------------------------------------------
's69%'
SQL>
chr(39) is a single quote (simpler to use it than repeating several single quotes):
SQL> select '''%' || empno || '%''' as result
2 from emp
3 where rownum = 1;
RESULT
--------------------------------------------
's69%'
SQL>
