我在理解带有 case 语句的 oracle(12c) sql order by 子句时遇到了困难。我有一张包含以下数据的表格,
SELECT DEPT_NO, DEPT_NAME FROM SORTNG_LOGIC;
DEPT_NO DEPT_NAME
---------- --------------------
1 FINANCE
2 ACCOUNT
3 HUMAN RESOURCE
4 AUDIT
5 TRAINING
Run Code Online (Sandbox Code Playgroud)
我正在为此表执行以下 sql 查询以在 oracle sql 开发人员上添加自定义订单。
SELECT DEPT_NO, DEPT_NAME FROM SORTNG_LOGIC ORDER BY (
CASE DEPT_NAME
WHEN 'ACCOUNT' THEN '1'
WHEN 'AUDIT' THEN '2'
WHEN 'FINANCE' THEN '3'
ELSE '4' END
)DESC;
Run Code Online (Sandbox Code Playgroud)
这给出了以下结果:
DEPT_NO DEPT_NAME
---------- --------------------
3 HUMAN RESOURCE
5 TRAINING
1 FINANCE
4 AUDIT
2 ACCOUNT
Run Code Online (Sandbox Code Playgroud)
但我预计,结果应该是
DEPT_NO DEPT_NAME
---------- …Run Code Online (Sandbox Code Playgroud) 我在设置父子pom文件的java编译器版本时面临问题.我在版本为1.7的子pom中添加了maven-compiler-plugin,并注意到java版本从默认值1.5更改为1.7,而子模块的父版本仍为1.5.然后,我将编译器插件从子pom移动到父pom.预计父级和子级maven模块的编译器版本将更改为1.7.但奇怪的是没有观察到任何变化,子模块仍然是1.7,父项目是1.5.我从eclipse IDE执行了'maven-> update project'.但没用 仅供参考:建立亲子项目工作正常,没有任何问题.有帮助吗?这是我的父母和孩子的POM
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mymaven.parentpom.example</groupId>
<artifactId>ParentPOMProj</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>ParentPOMProj</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>ParentPOMProj</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<compilerVersion>1.7</compilerVersion>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<module>ModuleOne</module>
</modules>
</project>
Run Code Online (Sandbox Code Playgroud)
http://maven.apache.org/xsd/maven-4.0.0.xsd"xmlns ="http://maven.apache.org/POM/4.0.0"xmlns:xsi ="http:// www. w3.org/2001/XMLSchema-instance"> 4.0.0
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mymaven.parentpom.example</groupId>
<artifactId>ParentPOMProj</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.mymaven.parentpom.example.module</groupId>
<artifactId>ModuleOne</artifactId>
<version>0.0.2-SNAPSHOT</version>
<name>ModuleOne</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> …Run Code Online (Sandbox Code Playgroud)