Á½¸ö¾µäµÄOracle´¥·¢Æ÷ʾÀý
¡¾°¸ÀýÒ»¡¿
ÌâÄ¿£º
--´¥·¢Æ÷£º
--Ìí¼ÓÔ±¹¤ÐÅÏ¢,Á÷Ë®ºÅ×÷Ϊ×Ô¶¯±àºÅ(ͨ¹ýÐòÁÐÉú³É),
--²¢ÇÒÅжÏÈç¹û¹¤×ÊСÓÚ0,Ôò¸ÄΪ0;Èç¹û´óÓÚ10000,Ôò¸ÄΪ10000¡£
CREATE TABLE emp2(
e_id NUMBER,
e_no NUMBER,
e_name VARCHAR2(20),
e_sal NUMBER
)
SELECT * from emp2;
CREATE SEQUENCE seq_trg_id;
INSERT INTO emp2(e_id,e_no,e_name,e_sal) VALUES(seq_trg_id.nextval,7788,'ÕÂ×Ó',
1000000000000)
INSERT INTO emp2(e_id,e_no,e_name,e_sal) VALUES(seq_trg_id.nextval,7788,'ÕÂ×Óâù',-10)
CREATE OR REPLACE TRIGGER trg_add_emp_info
BEFORE INSERT
ON emp2
FOR EACH ROW
DECLARE
-- local variables here
BEGIN
SELECT seq_trg_id.NEXTVAL INTO :NEW.e_id from dual;
IF :NEW.e_sal < 0 THEN
:NEW.e_sal := 0;
ELSIF :NEW.e_sal > 10000 THEN
:NEW.e_sal := 10000;
END IF;
END;
¡¾ °¸Àý¶þ¡¿
ÌâÄ¿£º
--À©³äÁ·Ï°£º
--Ϊemp½¨Á¢´¥·¢Æ÷,½«É¾³ýµÄ¼Ç¼·Åµ½emp3±íÖÐ(autoid,deptno,empno,ename,del_rq-ɾ³ýÈÕÆÚ)
--²âÊÔ´úÂë
CREATE TABLE emp3(
autoid NUMBER PRIMARY KEY,
deptno NUMBER,
empno NUMBER,
ename VARCHAR2(20),
del_rq DATE
)
CREATE SEQUENCE seq_trg_del_autoid;
INSERT INTO emp
(empno, ename, deptno)
VALUES
(114, '°¢½¿', 10);
COMMIT;
SELECT * from emp;
DELETE emp WHERE empno = 114;
SELECT * from emp3;
´ð°¸£º
CREATE OR REPLACE TRIGGER trg_del_emp_info
BEFORE DELETE
ON emp
FOR EACH ROW
DECLARE
-- local variables here
BEGIN
INSERT INTO emp3(autoid,deptno,empno,ename,del_rq)
VALUES(seq_trg_del_autoid.NEXTVAL,:OLD.deptno,:OLD.empno,:OLD.ename,sysdate);
END;
ÔÎijö´¦£ºhttp://blog.csdn.net/justdo2008/archive/2009/04/29/4137779.aspx
Ïà¹ØÎĵµ£º
Èç¹ûÊý¾ÝÎļþË𻵣¬»áÓöµ½1157 ºÍ 1110µÄ´íÎó¡£ÕâʱºòÐèÒª½éÖʻָ´Êý¾Ý¿â¡£
»Ö¸´Êý¾Ý¿âÐèÒªÓÐÏàÓ¦µÄ±¸·ÝºÍ±¸·ÝÒÔÀ´²úÉúµÄËùÓеĹ鵵ÈÕÖ¾ÎļþºÍÁª»úÈÕÖ¾Îļþ¡£
Èç¹ûÔÚmountµ½openµÄʱºò·¢ÏÖÆÕͨµÄÊý¾ÝÎļþË𻵣¬Êý¾Ý¿â»áÍ£ÁôÔÚmount״̬Ï£¬Õâʱºò¿ÉÒÔÖ´ÐÐalter database datafile x offline drop ºÍalter database open à ......
ÅäÖÃÐÅÏ¢Ó¦¸Ã¶¼Ã»ÓÐ´í£¬Çý¶¯Ò²·´¸´¼ÓÔØÁË£¬Ã»ÓÐÎÊÌâ
ÔËÐÐMyeclipse±àÒë¿É¹ý£¬ÔÚÍøÒ³²âÊÔʱ³öÏÖÈçÏ´íÎó£º
java.sql.SQLException: µ÷ÓÃÖÐÎÞЧµÄ²ÎÊý
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError ......
ÎÒÓõÄÊÇCentos5.4 DVD¹âÅÌ°²×°µÄlinux²Ù×÷ϵͳ£¬°²×°linuxµÄʱºòÑ¡ÉÏ¿ª·¢¹¤¾ß£¬Xmanager,ÓëÊý¾Ý¿âÏà¹ØµÄ°ü¡£
²Ù×÷ϵͳ°²×°Íê³ÉÖ®ºóÐèÒª½øÐÐһϵÁеÄÅäÖòÅÄÜ°²×°oracle10g£¬ÏÂÃæ°ÑÖ÷Òª²½Öè¼Ç¼ÏÂÀ´¡£
1.°²×°Íê²Ù×÷ϵͳ֮ºó»¹ÊÇÓÐЩ°üûÓа²×°£¬È»¶ø°²×°oracle10gµÄʱºòÐèÒªÓõ½£¬Ã»Óа²×°µÄ°üÓÐ:
libXp-1.0.0-8.i386.rp ......
---------Êýѧº¯Êý
1.¾ø¶ÔÖµ
S:select abs(-1) value
O:select abs(-1) value from dual
2.È¡Õû(´ó)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:select cast(-1.002 as int) v ......
sql serverºÍoracleÐÐתÁеÄÒ»ÖÖµäÐÍ·½·¨
Ç°ÑÔ£ºÍøÉÏÓв»ÉÙÎÄÕÂÊǽ²ÐÐתÁеģ¬µ«ÊǴ󲿷ֶ¼ÊÇÖ±½ÓÌù´úÂ룬ºöÊÓÁËÖмä¹ý³Ì£¬±¾ÈË×Ô¼ºË¼¿¼ÁËÏÂΪʲôҪÕâÑùʵÏÖ£¬²¢ÇÒ×öÁËÈçϵıʼǣ¬¶ÔÓÐЩ¶®µÄÈËÀ´Ëµ¿ÉÄÜûÓмÛÖµ£¬Ï£Íû¶Ô»¹²»¶®µÄÈËÓÐÒ»µã½è¼øÒâÒå¡£
¶ÔÓÚÓÐЩҵÎñÀ´Ëµ£¬Êý¾ÝÔÚ±íÖеĴ洢ºÍÆä×îÖÕµÄGrid±íÏÖÇ¡ºÃÏ൱ÓÚ°ÑÔ ......