-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOracleQuery.java
More file actions
39 lines (32 loc) · 1.21 KB
/
OracleQuery.java
File metadata and controls
39 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package edu.java.contact06;
// JDBC에서 사용될 상수 및 SQL문 정의
public interface OracleQuery {
// 상수 정의
public static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
public static final String USER = "scott";
public static final String PASSWORD = "tiger";
public static final String TABLE_NAME = "EX_CONTACT";
public static final String COL_CID = "CID";
public static final String COL_NAME = "NAME";
public static final String COL_PHONE = "PHONE";
public static final String COL_EMAIL = "EMAIL";
// SELECT - ORDER BY CID
public static final String SQL_ORDER_BY_CID =
"SELECT * FROM " + TABLE_NAME + " ORDER BY CID";
// SELECT - CID
public static final String SQL_SELECT_BY_CID =
"SELECT * FROM " + TABLE_NAME + " WHERE " + COL_CID + " = ?";
// INSERT
public static final String SQL_INSERT =
"INSERT INTO " + TABLE_NAME + " VALUES (CONTACT_PK.NEXTVAL, ?, ?, ?)";
// UPDATE
public static final String SQL_UPDATE =
"UPDATE " + TABLE_NAME +
" SET " + COL_NAME + " = ?, "
+ COL_PHONE + " = ?, "
+ COL_EMAIL + " = ? " +
" WHERE " + COL_CID + " = ?";
// DELETE
public static final String SQL_DELETE =
"DELETE FROM " + TABLE_NAME + " WHERE " + COL_CID + " = ?";
}