Oracleѧϰ±Ê¼Çժ¼6
declare
begin
--SQLÓï¾ä
--Ö±½ÓдµÄSQLÓï¾ä(DML/TCL)
--¼ä½Óдexecute immediate <DDL/DCLÃüÁî×Ö·û´®>
--select Óï¾ä
<1>±ØÐë´øÓÐinto×Ó¾ä
select empno into eno from emp
where empno =7369;
<2>Ö»Äܲ鵽һÐÐ**********
<3>×ֶθöÊý±ØÐëºÍ±äÁ¿µÄ¸öÊýÒ»ÖÂ
exception
--Òì³£
when <Òì³£Ãû×Ö> then --Ìض¨Òì³£
<´¦ÀíÓï¾ä>
when others then --ËùÓÐÒì³£¶¼¿É²¶»ñ
<´¦ÀíÓï¾ä>
end;
<Àý×Ó>
±àд³ÌÐò ÏòDEPT±íÖвåÈëÒ»Ìõ¼Ç¼£¬
´Ó¼üÅÌÊäÈëÊý¾Ý£¬Èç¹û
Êý¾ÝÀàÐÍÊäÈë´íÎóÒªÓÐÌáʾ
ÎÞ·¨²åÈë¼Ç¼ Ò²ÒªÓÐÌáʾ
Ö»ÄÜÊäÈëÕýÊý,Èç¹ûÓиºÊýÌáʾ
declare
n number;
no dept.deptno%type;
nm dept.dname%type;
lc dept.loc%type;
exp exception; --Òì³£µÄ±äÁ¿
exp1 exception;
num number:=0; --¼ÆÊýÆ÷
pragma exception_init(exp,-1); --Ô¤¶¨ÒåÓï¾ä
--(-1´íÎóºÍÒì³£±äÁ¿¹ØÁª)
pragma exception_init(exp1,-1476);
e1 exception; --×Ô¶¨ÒåÒì³£±äÁ¿
begin
--ÊäÈëÖµ
no := '&񅧏';
num := num + 1;
if no < 0 then
raise e1; --×Ô¶¨ÒåÒì³£µÄÒý·¢
&
Ïà¹ØÎĵµ£º
1.Ê×ÏÈÐèÒª½¨Á¢plan table,·ñÔò²»ÄÜʹÓÃ
½¨Á¢·½·¨£º
$oracle\rdbms\adminÏÂÓиö
utlxplan.sql
ÆäÄÚÈÝΪ:
create table PLAN_TABLE (
statement_id varchar2(30),
timestamp date,
remarks varchar2(80),
operat ......
Êý¾Ý¿âµÄÆô¶¯ÓÐÈýÖÖ£º
1
£º
startup nomount
ÕâÖÖ¹ý³ÌÓÖ³ÆΪ£º·Ç°²×°Æô¶¯
Æô¶¯¹ý³ÌΪ£ºÆô¶¯
oracle
ʵÀý£¬²»¼ÓÔØÊý¾Ý¿â£¬²»´ò¿ªÊý¾Ý¿â¡£ÔÚÕâ¸ö¹ý³ÌÖÐÖ»ÐèÒª
init.ora
³õʼ»¯²ÎÊýÎļþ£¬Öؽ¨¿ØÖÆÎļþ£¬¼´Æô¶¯ ......
1.
´íÎóÌáʾ£ºORA-12545:ÒòÄ¿±êÖ÷»ú»ò¶ÔÏó²»´æÔÚ,Á¬½Óʧ°Ü.
´íÎóÖ¢×´£ºÐ½¨µÄÊý¾Ý¿âÔÚOEM¿ØÖÆ̨ÎÞ·¨ÏÔʾ£¨sysmanÓû§µÇ½£©£¬¶ÀÁ¢Æô¶¯Ä£Ê½¿ÉÒÔÕÒµ½£¬µ«ÎÞ·¨µÇ½£¬³öÏÖÈçÉÏ´íÎó¡£
½â¾ö°ì·¨£ºÐÞ¸Äoracle°²×°Ä¿Â¼Ï£¨oracle\ora90\network\ADMIN£©µÄtnsnames.oraÎļþ£¬½«µ±Ç°Êý¾Ý¿âÌí¼Óµ½¼àÌý¶ÔÏóÖС£ÐÞ¸ÄÖ®ºó£¬¿ÉÒÔÔÚ¶ÀÁ¢Ä ......
Ò»¡¢ÔÚPLSQLÖд´½¨±í£º
create table HWQY.TEST
(
CARNO VARCHAR2(30),
CARINFOID NUMBER
)
¶þ¡¢ÔÚPLSQLÖд´½¨´æ´¢¹ý³Ì£º
create or replace procedure pro_test
AS
carinfo_id number;
BEGIN
select s_CarInfoID.nextval into carinfo_id
from dual;
insert into test(test ......
oracleµÄÌåϵºÜÅÓ´ó£¬ÒªÑ§Ï°Ëü£¬Ê×ÏÈÒªÁ˽âoracleµÄ¿ò¼Ü¡£ÔÚÕâÀ¼òÒªµÄ½²Ò»ÏÂoracleµÄ¼Ü¹¹£¬ÈóõѧÕ߶ÔoracleÓÐÒ»¸öÕûÌåµÄÈÏʶ¡£
¡¡¡¡1¡¢ÎïÀí½á¹¹£¨ÓÉ¿ØÖÆÎļþ¡¢Êý¾ÝÎļþ¡¢ÖØ×öÈÕÖ¾Îļþ¡¢²ÎÊýÎļþ¡¢¹éµµÎļþ¡¢ÃÜÂëÎļþ×é³É£©
¡¡¡¡¿ØÖÆÎļþ£º°üº¬Î¬»¤ºÍÑéÖ¤Êý¾Ý¿âÍêÕûÐԵıØÒªÐÅÏ¢¡¢ÀýÈ磬¿ØÖÆÎļþÓÃÓÚʶ±ðÊý¾ÝÎļ ......