繁体   English   中英

Oracle SQL:串联 - 缺少表达式

[英]Oracle SQL : concatenation - missing expression

我正在使用Employees表来练习以下内容:

我想显示一个带有声明的列

This is my New salary after 10% increase :- and salary + 10% 

以下是我使用的脚本,但没有用

select 
    Salary,
    'This is my new Salary after 10% increase :- ' || Salary + 10%, 
From 
    Employees;

呵呵,那是你唯一希望的(我的意思是,发明你自己的语法)。 应该是例如

SQL> select sal,
  2    'This is my new salary after 10% increase: ' || sal * 1.1 as result
  3  from emp
  4  where empno = 7369;

       SAL RESULT
---------- -------------------------------------------------------------------
      1000 This is my new salary after 10% increase: 1100

SQL>

请试试这个:

select 
Salary,
'This is my new Salary after 10% increase :- ' || Salary * 1.1 NEW_SAL
From Employees;

Output:2600 这是我加薪 10% 后的新工资:- 2860

我认为你应该可以使用 val + 它的 10%,所以 val 的 110%。 此外,您不能使用 110%(您将被迫施放它等),因此最好使用 1.1 的 val。

SELECT 
   sal AS Salary,
   'This is my new salary after 10% increase: ' || sal * 1.1 AS 'New Salary'
 FROM emp;

因此,对于所有员工,您应该看到他们当前的薪水和薪水的 110%。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM