createsetprice.java
来自「此程序都是企业级 的数据库开发程序 全面揭示了JAVA对数据库的操作」· Java 代码 · 共 35 行
JAVA
35 行
package procedures;
import java.sql.*;
import java.util.*;
import connections.*;
public class CreateSetPrice {
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
try {
conn = ConnectionFactory.getConnection();
stmt = conn.createStatement();
String sql = "create or replace procedure set_price ( "
+ "id in number, price in number)" + "as begin "
+ "update recordings set listprice = price "
+ "where recordingid = id; end;";
int result = stmt.executeUpdate(sql);
// expected value of result is 0 for create procedure
// if no exception is thrown, assume the procedure was created
System.out.println("Procedure created successfully");
} catch (Exception e) {
System.out.println("Procedure NOT created");
e.printStackTrace();
}
finally {
ConnectionFactory.close(stmt);
ConnectionFactory.close(conn);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?