oracle

sqlplus system/oracle@orcl
conn / as sysdba;
alter user scott account unlock;
alter user scott identified by tiger;
conn scott/tiger;


用scott/tiger用户
执行:完整的HR_SCOTT.sql

-----或者--------------
导出、导入HR表:
exp system/oracle tables=(hr.countries,hr.departments,hr.employees,hr.jobs,hr.job_history,hr.locations,hr.regions) file=d:\hr_table.dmp
imp system/oracle file=d:\hr_table.dmp fromuser=hr touser=scott

导出、导入SCOTT表:
exp system/oracle tables=(scott.bonus,scott.dept,scott.emp) file=d:\scott_table.dmp
imp system/oracle file=d:\scott_table.dmp fromuser=scott touser=scott



创建工资等级表:
create table scott.salgrades(
  lowest_salary number,
  highest_salary number,
  grade_level number
 );

  insert into salgrades values(1000,5000,1);
  insert into salgrades values(5001,10000,2);
  insert into salgrades values(10001,20000,3);
  insert into salgrades values(20001,50001,4);
  insert into salgrades values(50001,10000,5);




-----JDBC-----------------------------------------------
创建测试存储过程
create or replace procedure SCOTT.P_INSERT_DEPT(
DEPTNO IN NUMBER, 
DNAME IN VARCHAR2, 
LOC IN VARCHAR2) is
begin
     INSERT INTO SCOTT.DEPT VALUES (DEPTNO,DNAME,LOC);
end P_INSERT_DEPT;

创建测试的包内存储过程
create or replace package scott.PACKAGE_SCOTT is

  PROCEDURE P_INSERT_DEPT(
        DEPTNO         IN     NUMBER,
        DNAME          IN     VARCHAR2  DEFAULT NULL,
        LOC            IN     VARCHAR2  DEFAULT NULL);
  PROCEDURE P_INSERT_DEPT_OUT(
        DEPTNO         IN     NUMBER,
        DNAME          IN     VARCHAR2  DEFAULT NULL,
        LOC            IN     VARCHAR2  DEFAULT NULL,
        RETURNVALUE    OUT    VARCHAR2);

end PACKAGE_SCOTT;
/
create or replace package body scott.PACKAGE_SCOTT is
  PROCEDURE P_INSERT_DEPT(
        DEPTNO         IN     NUMBER,
        DNAME          IN     VARCHAR2  DEFAULT NULL,
        LOC            IN     VARCHAR2  DEFAULT NULL) AS

        BEGIN
           INSERT INTO SCOTT.DEPT VALUES (DEPTNO,DNAME,LOC);
        END P_INSERT_DEPT;

  PROCEDURE P_INSERT_DEPT_OUT(
        DEPTNO         IN     NUMBER,
        DNAME          IN     VARCHAR2  DEFAULT NULL,
        LOC            IN     VARCHAR2  DEFAULT NULL,
        RETURNVALUE    OUT    VARCHAR2) AS

        BEGIN
           INSERT INTO SCOTT.DEPT VALUES (DEPTNO,DNAME,LOC);
           SELECT to_char(sysdate,'yyyy-MM-dd') INTO RETURNVALUE FROM DUAL;
        END P_INSERT_DEPT_OUT;

end PACKAGE_SCOTT;
/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值