create [or replace] procedure procedure-name
[parameter]
is
[declaration-section]
begin
[executable section]
end [procedure-name];
PROCEDURE PROGRAM TO UPDATE SALARY OF ALL EMPLOYEE
SQL> create or replace procedure update_sal
is
begin
update emp set sal=sal+100;
end;
/
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Test15 {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "rakesh");
CallableStatement cs = con.prepareCall("{call update_sal}");
cs.execute();
}
}
[parameter]
is
[declaration-section]
begin
[executable section]
end [procedure-name];
PROCEDURE PROGRAM TO UPDATE SALARY OF ALL EMPLOYEE
SQL> create or replace procedure update_sal
is
begin
update emp set sal=sal+100;
end;
/
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Test15 {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "rakesh");
CallableStatement cs = con.prepareCall("{call update_sal}");
cs.execute();
}
}
No comments:
Post a Comment