part.sqlj
来自「orale培训教材包括了所有的sql说明和实例」· SQLJ 代码 · 共 48 行
SQLJ
48 行
// IMPORT NECESSARY Classes
import sqlj.runtime.*;
import sqlj.runtime.ref.*;
import java.sql.*;
public class Part {
// METHODS TO INSERT, UPDATE, AND DELETE PARTS
public static void insert (
oracle.sql.NUMBER id,
oracle.sql.CHAR description,
oracle.sql.NUMBER unitPrice,
oracle.sql.NUMBER onHand,
oracle.sql.NUMBER reorder ) throws SQLException {
try {
#sql {
INSERT INTO practice06.parts
VALUES (:id, :description, :unitPrice, :onHand, :reorder) };
} catch (SQLException e) {System.err.println(e.getMessage());}
}
public static void update (
oracle.sql.NUMBER id,
oracle.sql.CHAR description,
oracle.sql.NUMBER unitPrice,
oracle.sql.NUMBER onHand,
oracle.sql.NUMBER reorder ) throws SQLException {
try {
#sql {
UPDATE practice06.parts
SET description = :description,
unitprice = :unitPrice,
onhand = :onHand,
reorder = :reorder
WHERE id = :id };
} catch (SQLException e) {System.err.println(e.getMessage());}
}
public static void delete (oracle.sql.NUMBER id) throws SQLException {
try {
#sql {DELETE FROM practice06.parts WHERE id = :id };
} catch (SQLException e) {System.err.println(e.getMessage());}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?