求助求助,懂Oracle数据库的哥哥姐姐帮帮忙!
这四道题有会的么,??这是我拿大学毕业证必须得考的,求大神帮忙啊,做出来帮忙发一下,254944268。万分感激啊...
这四道题有会的么,??这是我拿大学毕业证必须得考的,求大神帮忙啊,做出来帮忙发一下,254944268。万分感激啊
展开
2个回答
展开全部
自己对号入座吧
1、创建用户(system用户下执行)
create user abc identified by 654321;
grant connect,resource to abc;
create public synonym table_name for system.table_name;
scott用户下执行:grant select on emp to abc;
2、
create table student
(学号 int,
姓名 varchar2(10),
性别 char(2),
年龄 int,
籍贯 varchar2(50),
联系电话 varchar2(20));
create unique index idx_student_uk on student(学号);
alter table student add constraint constraint_sex check(性别 in ('男','女'));
3、
create view1 as
select * from emp where deptno in (select deptno from dept where loc='CHICAGO')
with read only;
4、
create procedure insert_one_student
(v_xuehao int,
v_name varchar2,
v_sex varchar2,
v_age int,
v_address varchar2,
v_phone varchar2)
as
begin
insert into student values (v_xuehao,v_name,v_sex,v_age,v_address,v_phone);
commit;
end insert_one_student;
最后一个没写包,没抛异常,请在自己查资料的情况下写进去
1、创建用户(system用户下执行)
create user abc identified by 654321;
grant connect,resource to abc;
create public synonym table_name for system.table_name;
scott用户下执行:grant select on emp to abc;
2、
create table student
(学号 int,
姓名 varchar2(10),
性别 char(2),
年龄 int,
籍贯 varchar2(50),
联系电话 varchar2(20));
create unique index idx_student_uk on student(学号);
alter table student add constraint constraint_sex check(性别 in ('男','女'));
3、
create view1 as
select * from emp where deptno in (select deptno from dept where loc='CHICAGO')
with read only;
4、
create procedure insert_one_student
(v_xuehao int,
v_name varchar2,
v_sex varchar2,
v_age int,
v_address varchar2,
v_phone varchar2)
as
begin
insert into student values (v_xuehao,v_name,v_sex,v_age,v_address,v_phone);
commit;
end insert_one_student;
最后一个没写包,没抛异常,请在自己查资料的情况下写进去
追问
这位哥哥还是姐姐,能加我好友吗?254944268 ,我想具体问你一下啊 谢谢啊
展开全部
一、
create user abc identified by "654321";
grant connect,resource,create public synonym to abc;
grant select on scott.emp to abc;
二、
create table scott.student (
id number primary key, --学号
name varchar2(100), --姓名
sex char(2) check (sex='男' or sex='女') , --性别
age int, --年龄
orig varchar2(10), --籍贯
tel varchar2(15) --联系电话
);
三、
create or replace view scott.view1 as select a.* from scott.emp a,scott.dept b where a.deptno=b.deptno and b.loc='CHICAGO';
四、
CREATE OR REPLACE PACKAGE scott.STUDENT_PACK AS
PROCEDURE INSERT_ONE_STUDENT(id number, name varchar2,sex char,age int,orig varchar2,tel varchar2);
END STUDENT_PACK;
/
CREATE OR REPLACE PACKAGE BODY scott.STUDENT_PACK AS
PROCEDURE INSERT_ONE_STUDENT(id number, name varchar2,sex char,age int,orig varchar2,tel varchar2) IS
BEGIN
INSERT INTO STUDENT VALUES (id,name,sex,age,orig,tel);
EXCEPTION WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20000,'插入错误!');
END;
end student_pack;
/
create user abc identified by "654321";
grant connect,resource,create public synonym to abc;
grant select on scott.emp to abc;
二、
create table scott.student (
id number primary key, --学号
name varchar2(100), --姓名
sex char(2) check (sex='男' or sex='女') , --性别
age int, --年龄
orig varchar2(10), --籍贯
tel varchar2(15) --联系电话
);
三、
create or replace view scott.view1 as select a.* from scott.emp a,scott.dept b where a.deptno=b.deptno and b.loc='CHICAGO';
四、
CREATE OR REPLACE PACKAGE scott.STUDENT_PACK AS
PROCEDURE INSERT_ONE_STUDENT(id number, name varchar2,sex char,age int,orig varchar2,tel varchar2);
END STUDENT_PACK;
/
CREATE OR REPLACE PACKAGE BODY scott.STUDENT_PACK AS
PROCEDURE INSERT_ONE_STUDENT(id number, name varchar2,sex char,age int,orig varchar2,tel varchar2) IS
BEGIN
INSERT INTO STUDENT VALUES (id,name,sex,age,orig,tel);
EXCEPTION WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20000,'插入错误!');
END;
end student_pack;
/
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询