有人知道为什么这个查询语句在此查询中运行的很好吗,但是当我在同一个选择语句前添加cte时,会出现此错误:
SQL错误:ORA-00957:列名重复)
CREATE TABLE t1 AS
SELECT *
FROM NS_F3
LEFT JOIN NS_FA2
ON NS_F3.PI_CANDIDATE_NUM = NS_FA2.PI_CANDIDATE_NUM
WHERE REGEXP_LIKE(NS_F3.TITLE, 'intern($|ship|[^a-z])', 'i');
答案 0 :(得分:6)
这是因为表public void Send_Command(View v) {
testClass();
Toast.makeText(getApplicationContext(), "Comando Enviado!", Toast.LENGTH_LONG).show();
}
public static void testClass() {
Thread cThread = new Thread(new ClientThread());
cThread.start();
}
public static class ClientThread implements Runnable {
String results = "";
public void run() {
try {
InetAddress serverAddr = InetAddress.getByName(serverIpAddress);
System.out.println("C: Connecting...");
while (true) {
results = "";
try {
Socket socket = new Socket("192.168.1.77", 8888);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
out.write("Test");
out.flush();
String inMsg = "";
boolean b = false;
while (!b) {
inMsg = in .readLine();
if (inMsg != "")
b = true;
}
socket.close();
System.out.println("C: Closed.");
} catch (Exception e) {
System.out.println("S: Error" + e.toString());
}
}
} catch (Exception e) {
System.out.println("C: Error" + e);
}
}
}
和NS_F3
包含具有相同名称的列-在这种情况下,应使用列别名以避免重复的列名。
这里是一个例子:我正在创建一个简单表,作为斯科特NS_FA2
表中几列的摘录:
EMP
将其加入SQL> create table t_first as select deptno, empno, ename from emp where rownum < 5;
Table created.
表:
DEPT
只要它可以在SQL> select * from t_first e join dept d on e.deptno = d.deptno;
DEPTNO EMPNO ENAME DEPTNO DNAME LOC
---------- ---------- ---------- ---------- -------------- -------------
20 7369 SMITH 20 RESEARCH DALLAS
20 7566 JONES 20 RESEARCH DALLAS
30 7521 WARD 30 SALES CHICAGO
30 7499 ALLEN 30 SALES CHICAGO
^^^^^^^^^ ^^^^^^^^
this is DEPTNO column ... ... and here's another one
中使用,就不能在SELECT
中使用:
CREATE TABLE
解决方案是使用列别名,例如:
SQL> create table test as
2 select * from t_first e join dept d on e.deptno = d.deptno;
select * from t_first e join dept d on e.deptno = d.deptno
*
ERROR at line 2:
ORA-00957: duplicate column name