TableSpace
±í¿Õ¼ä£º Ò»¸ö±í¿Õ¼ä¶ÔÓ¦¶à¸öÊý¾ÝÎļþ(ÎïÀíµÄdbfÎļþ) ÓÃÓï·¨·½Ê½´´½¨tablespace£¬ÓÃsysdbaµÇ½£º --´´½¨±í¿Õ¼ämytabs£¬´óСΪ10MB:
create tablespace mytabs datafile 'C:\oracle\oradata\mydb\mytabs1.dbf' size 10M; alter user zgl default tablespace mytabs; --°Ñtabs×öΪzglµÄĬÈϱí¿Õ¼ä¡£ grant unlimited tablespace to zgl; --½«²Ù×÷±í¿Õ¼äµÄȨÏÞ¸øzgl¡£
Exception ʾÀý£º create or replace procedure pro_test_exception(vid in varchar2) is userName varchar2(30); begin select name into userName from t_user where id=vid; dbms_output.put_line(userName); exception when no_data_found then dbms_output.put_line('ûÓв鵽Êý¾Ý£¡'); when too_many_rows then dbms_output.put_line('·µ»ØÁ˶àÐÐÊý¾Ý£¡'); end pro_test_exception;
°²È«¹ÜÀí
ÒÔÏÂÓï¾äÒÔsysdbaµÇ½£º Óû§ÊÚȨ£º alter user zgl account lock;--Ëø¶¨Õʺš£ alter user zgl identified by zgl11;--ÐÞ¸ÄÓû§ÃÜÂë¡£ alter user zgl account unlock;--½â³ýÕʺÅËø¶¨¡£ alter user zgl default tablespace tt;--ÐÞ¸ÄÓû§zglµÄĬÈϱí¿Õ¼äΪtt¡£ create user qqq identified by qqq123 default tablespace tt;--´´½¨Óû§¡£
grant connect to qqq;--¸øqqqÊÚÓèconnectȨÏÞ¡£ grant execute on zgl.proc01 to test;--½«¹ý³Ìzgl.proc01ÊÚÓèÓû§test¡£ grant create user to zgl;--¸øzglÊÚÓè´´½¨Óû§µÄȨÏÞ¡£ revoke create user from zgl;--½â³ýzgl´´½¨Óû§µÄȨÏÞ¡£
½ÇÉ«ÊÚȨ£º create role myrole;--´´½¨½ÇÉ«myrole grant connect to myrole;--¸ømyroleÊÚÓèconnectȨÏÞ grant select on zgl.t_user to myrole;--°Ñ²éѯzgl.t_userµÄȨÏÞÊÚÓèmyrole grant myrole to test;--°Ñ½ÇÉ«myroleÊÚÓètestÓû§
¸ÅÒªÎļþ(ÅäÖÃÎļþ)£º È«¾ÖÉèÖ㬿ÉÒÔÔÚ¸ÅÒªÎļþÖÐÉèÖõǽ´ÎÊý£¬È糬¹ýÕâ´ÎÊý¾ÍËø¶¨Óû§¡£
Synonym
´´½¨Í¬Òå´ÊʾÀý£º
create public synonym xxx for myuser.t_user create synonym t_user for myuser.t_user select * from dba_synonyms where table_name='T_USER'
¿çÊý¾Ý¿â²éѯ create database link dblinkzgl connect to myuser identified by a using 'mydb' Select * From t_user@dblinkzgl
courseʾÀý ʾÀý1£º create or replace procedure pro_test_cursor is userRow t_user%rowtype; cursor userRows is select * from t_user; begin for userRow in userRows loop dbms_output.put_line (userRow.Id||','||userRow.Name||','||userRows%rowcount); end loop; end pro_test_cursor;
ʾÀý2£º create or replace procedure pro_test_cursor_oneRow(vid in number) is userRow t_user%rowtype; cursor userCur is select * from t_user where id=vid; begin open userCur; fetch userCur into userRow; if userCur%FOUND then dbms_output.put_line (userRow.id||','||userRow.Name); end if; close userCur; end pro_test_cursor_oneRow;
recordʾÀý create or replace procedure pro_test_record(vid in varchar2) is type userRow is record( id t_user.id%type, name t_user.name%type ); realRow userRow; begin select id,name into realRow from t_user where id=vid; dbms_output.put_line (realRow.id||','||realRow.name); end pro_test_record;
rowtypeʾÀý create or replace procedure pro_test_rowType(vid in varchar2) is userRow t_user%Rowtype; begin select * into userRow from t_user where id=vid; dbms_output.put_line (userRow.id||','||userRow.name); end pro_test_rowType; |