1.然后输入pȝ用户名和密码
用户?/span>/创徏表空?/span>
create tablespace 表空间的存放路径,I间的自动增长的值是10M
permanent online; --创徏用户
create user shi --创徏密码?/span>scj
default tablespace 默认表空间名
temporary tablespace temp --?/span>profile表空间名; --创徏角色
create role 密码;
5.角色名;--角色?/span> to 把角色授予用?/span>
6.l?/span>shil?/span>shi察看当前用户下的所有表
8.select tablespace_name from user_tablespaces; 表空?/span>
9.select username from dba_users;必须?/span>sys as sysdba创徏?/span>
create table 表空间名 --表的初始?/span>
minextents 1 --最大扩展?/span>
);
11.--表添加主键和索引
alter table users
add constraint pk primary key (ID);
12.表添加外?/span>
alter table users
add constraint fk_roleid foreign key (roleid)
references role(role_id) on delete cascad; --是创建?/span>
13.表名Q?/span> --?/span>id截取字符?/span>
select column(name,'表名Q?/span> --中的‘L
15.打开输入输出Q不写的?/span>,的应?/span>
declare --复职
a number:=0;
begin --循环
if((ccc mod 3)=0) then --打印昄
a:=a+ccc;
end if; --l束循环
dbms_output.put_line(a);
end; --的用?/span> --姓名为:(x)'||name);
end;
/
18.属性可以在q行时方便的声明记录变量和其他结?/span>
Set serveroutput on;
Declare
utype users%rowtype;
Begin
Select * into utype from users where id=20;
Dbms_output.put_line('生日'|| utype.brithday);
end;
/ --%rowtype游标的定义和使用
Declare
Cursor ucur is select * from users; --定义与游标想匚w的变?/span>
Begin
Open ucur;--使用循环遍历游标的查询结?/span>
Dbms_output.put_line('生日'||us.brithday);
Fetch ucur into us;
End loop;
Close ucur; --在前一条的fetch属性gؓ(f)true在前一?/span>fetch属性gؓ(f)true在游标打开?/span>%isopenQ否则ؓ(f)false;
%rowcount删除
drop tablespace 删除表空间和里面的内?/span>
drop table 删除?/span>
drop user 删除用户