簡體   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