Oracle PL\SQL²Ù×÷£¨Áù£©Óû§ºÍ½ÇÉ«
1.Óû§¹ÜÀí
£¨1£©½¨Á¢Óû§£¨Êý¾Ý¿âÑéÖ¤£©
CREATE USER smith
IDENTIFIED BY smith_pwd
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp
QUOTA 5m ON users;
£¨2£©ÐÞ¸ÄÓû§
ALTER USER smith
QUOTA 0 ON SYSTEM;
£¨3£©É¾³ýÓû§
DROP USER smith;
DROP USER smith CASCADE;
£¨4£©ÏÔʾÓû§ÐÅÏ¢
DBA_USERS
DBA_TS_QUOTAS
2.ϵͳȨÏÞ
ϵͳȨÏÞ
×÷ÓÃ
CREATE SESSION
Á¬½Óµ½Êý¾Ý¿â
CREATE TABLE
½¨±í
CREATE TABLESPACE
½¨Á¢±í¿Õ¼ä
CREATE VIEW
½¨Á¢ÊÓͼ
CREATE SEQUENCE
½¨Á¢ÐòÁÐ
CREATE USER
½¨Á¢Óû§
ϵͳȨÏÞÊÇÖ¸Ö´ÐÐÌض¨ÀàÐÍSQLÃüÁîµÄȨÀû£¬ÓÃÓÚ¿ØÖÆÓû§¿ÉÒÔÖ´ÐеÄÒ»¸ö»òÒ»ÀàÊý¾Ý¿â²Ù×÷¡££¨Ð½¨Óû§Ã»ÓÐÈκÎȨÏÞ£©
£¨1£©ÊÚÓèϵͳȨÏÞ
GRANT CREATE SESSION£¬CREATE TABLE
TO smith;
GRANT CREATE SESSION TO smith
WITH ADMIN OPTION;
Ñ¡ÏADMIN OPTION ʹ¸ÃÓû§¾ßÓÐתÊÚϵͳȨÏÞµÄȨÏÞ¡£
£¨2£©ÏÔʾϵͳȨÏÞ
²é¿´ËùÓÐϵͳȨÏÞ£º
system_privilege_map
ÏÔʾÓû§Ëù¾ßÓеÄϵͳȨÏÞ£º
dba_sys_privis
ÏÔʾµ±Ç°Óû§Ëù¾ßÓеÄϵͳȨÏÞ£º
user_sys_privis
ÏÔʾµ±Ç°»á»°Ëù¾ßÓеÄϵͳȨÏÞ£º
session_privis
£¨3£©ÊÕ»ØϵͳȨÏÞ
REVOKE CREATE TABLE from smith;
REVOKE CREATE SESSION from smith;
3.½ÇÉ«£ºÊÇÒ»×éÏà¹ØȨÏÞµÄÃüÃû¼¯ºÏ£¬Ê¹ÓýÇÉ«×îÖ÷ÒªµÄÄ¿µÄÊǼò»¯È¨ÏÞ¹ÜÀí¡£
•Ô¤¶¨Òå½ÇÉ«¡£
ØCONNECT ×Ô¶¯½¨Á¢£¬°üº¬ÒÔÏÂȨÏÞ£ºALTER SESSION¡¢CREATE CLUSTER¡¢CREATE DATABASE LINK¡¢CREATE SEQUENCE¡¢CREATE SESSION¡¢CREATE SYNONYM¡¢CREATE TABLE¡¢CREATE VIEW ¡£
RESOURCE ×Ô¶¯½¨Á¢£¬°üº¬ÒÔÏÂȨÏÞ£ºCREATE CLUSTER¡¢CREATE PROCEDURE¡¢CREATE SEQUENCE¡¢CREATE TABLE¡¢CREATE TRIGGR ¡£
ØÏÔʾ½ÇÉ«ÐÅÏ¢£¬
§ROLE_SYS_PRIVS
§ROLE_TAB_PRIVS
§ROLE_ROLE_PRIVS
§SESSION_ROLES
§USER_ROLE_PRIVS
§DBA_ROLES
4.OracleÓû§½ÇÉ«
ÿ¸öÓû§¶¼ÓÐÒ»¸öÃû×ֺͿÚÁî,²¢ÓµÓÐһЩÓÉÆä´´½¨µÄ±í¡¢ÊÓͼºÍ×ÊÔ´¡£Oracle½ÇÉ«£¨role£©¾ÍÊÇÒ»×éȨÏÞ£¨privilege£©(»òÕßÊÇÿ¸öÓû§¸ù¾ÝÆä״̬ºÍÌõ¼þËùÐèµÄ·ÃÎÊÀàÐÍ)¡£Óû§¿ÉÒÔ¸ø½ÇÉ«ÊÚÓè»ò¸³ÓèÖ¸¶¨µÄȨÏÞ£¬È»ºó½«½ÇÉ«¸³¸øÏàÓ¦µÄÓû§¡£Ò»¸öÓû§Ò²¿ÉÒÔÖ±½Ó¸øÆäËûÓû§ÊÚȨ¡£ ÆäËûOracle
ϵͳȨÏÞ£¨Database Sys
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
×öÊý¾Ý¿â¿ª·¢»ò¹ÜÀíµÄÈ˾³£Òª´´½¨´óÁ¿µÄ²âÊÔÊý¾Ý£¬¶¯²»¶¯¾ÍÐèÒªÉÏÍòÌõ£¬Èç¹ûÒ»ÌõÒ»ÌõµÄ¼È룬ÄÇ»áÀË·Ñ´óÁ¿µÄʱ¼ä£¬±¾ÎĽéÉÜÁËOracleÖÐÈçºÎͨ¹ýÒ»ÌõSQL¿ìËÙÉú³É´óÁ¿µÄ²âÊÔÊý¾ÝµÄ·½·¨¡£
²úÉú²âÊÔÊý¾ÝµÄSQLÈçÏ£º
SQL> select rownum as id,
2 &nbs ......
OracleµÄÊý¾ÝÀàÐÍ
1.×Ö·ûÀàÐÍ
•CHAR(n) ¶¨³¤×Ö·û´®£¬n×Ö½Ú£¬nµÄÈ¡Öµ·¶Î§£º1~2000×Ö½Ú¡£
•VARCHAR2(n) ¿É±ä³¤µÄ×Ö·û´®£¬¶¨ÒåʱӦָÃ÷×î´ó³¤¶È£¬È¡Öµ·¶Î§£º1~ 4000×Ö½Ú¡£
•LONG ¿É±ä³¤×Ö·ûÁУ¬×î´ó³¤¶ÈÏÞÖÆ2GB£¬Ò»ÖÖ½ÏÀϵÄÊý¾ÝÀàÐÍ£¬Öð½¥±»BLOB¡¢CLOB¡¢µÈ´ó¶ÔÏóÊý¾ÝÀàÐÍËùÈ¡´ú¡£
2.Êý×ÖÀàÐÍ
&bull ......