oracle exists and not exist
ÏÈ¿´ÏÂÃæµÄÀý×Ó:oracleÖÐÁ½¸öϵͳ±í.emp,dept.
example:
1:not exists(not in)
not exists:
ÕâÌõÓï¾ä·µ»Øselect * from scott.dept d where e.deptno=d.deptno and d.deptno=10Ìõ¼þÂú×ãµÄ½á¹û¼¯.Ò²¾ÍÊÇ˵,
·µ»ØµÄ½á¹û¼¯Öв»´æÔÚd.deptno=10½á¹û¼¯µÄ¼Ç¼,¼´emp±íÖÐûÓÐdept±íÖÐd.deptno=10µÄ¼Ç¼.
SQL> select empno,ename,deptno from scott.emp e where not exists(select * from scott.dept d where e.deptno=d.deptno and d.deptno=10);
EMPNO ENAME DEPTNO
----- ---------- ------
7369 SMITH 20
7499 ALLEN 30
7521 WARD 30
7566 JONES 20
7654 MARTIN 30
7698 BLAKE 30
7788 SCOTT 20
7844 TURNER 30
7876 ADAMS 20
7900 JAMES 30
7902 FORD 20
11 rows selected
not in:
µÚÒ»¸öwhereÌõ¼þ±ØÐë¸ø¶¨×Ö¶Î(deptno), µÚ¶þ¸ösqlÓï¾äÖÐ,±ØÐëÃ÷È·¸ø¶¨Òª²éѯµÄ×Ö¶ÎÊÇÄĸö(deptno).
SQL> select empno,ename,deptno from scott.emp e where deptno not in(select deptno from scott.dept d where e.deptno=d.deptno and d.deptno=10);
EMPNO ENAME DEPTNO
----- ---------- ------
7369 SMITH 20
7499 ALLEN 30
7521 WARD 30
7566 JONES
Ïà¹ØÎĵµ£º
1¡¢²éÕÒ±íµÄËùÓÐË÷Òý£¨°üÀ¨Ë÷ÒýÃû£¬ÀàÐÍ£¬¹¹³ÉÁУ©£º
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = Òª²éѯµÄ±í
2¡¢²éÕÒ±íµÄÖ÷¼ü£¨°üÀ¨Ãû³Æ£¬¹¹³ÉÁУ©£º
select cu.* from user_cons_columns cu, user_constr ......
/*²»´øÈκβÎÊý´æ´¢¹ý³Ì(Êä³öϵͳÈÕÆÚ)*/
create or replace procedure output_date is
begin
dbms_output.put_line(sysdate);
end output_date;
/*´ø²ÎÊýinºÍoutµÄ´æ´¢¹ý³Ì*/
create or replace procedure get_username(v_id in number,v_username out varchar2)
as
begin
select username into v_usern ......
select lower( column_name) ||','||'--'||comments
from user_col_comments c
where c.table_name = upper('acc_fundcap')
SELECT * from USER_TAB_COMMENTS WHERE TABLE_NAME='T_META';
INSERT INTO ±íÃû(×Ö¶ÎÃû1, ×Ö¶ÎÃû2) SELECT ×Ö¶ÎÃû1, ×Ö¶ÎÃû2 from ÁíÍâµÄ±íÃû; ......
Ï൱ÓÚalias(±ðÃû),±ÈÈç°Ñuser1.table1ÔÚuser2Öн¨Ò»¸öͬÒå´Êtable1
create synonym table1 for user1.table1;
ÕâÑùµ±ÄãÔÚuser2Öвéselect * from table1ʱ¾ÍÏ൱ÓÚ²éselect * from user1.table1;
Óŵã×Ô¼º×ܽá°É¡£
ÀýÈ磺
ÔÚoracleÖжÔÓû§µÄ¹ÜÀíÊÇʹÓÃȨÏ޵ķ½Ê½À´¹ÜÀíµÄ£¬Ò²¾ÍÊÇ˵£¬Èç¹ûÎÒÃÇÏëʹÓÃÊý¾Ý¿â£¬ÎÒà ......
ÿ¸ô¼¸ÃëÖÓlistenerÈÕÖ¾ÖоͳöÏÖÒ»´Î¸Ã´íÎóµÄ¼Ç¼£¬¼´Ê¹ÊÇÔÚûÓÐÈËʹÓõÄÇé¿öÏÂÒ²ÊÇÈç´Ë£¬²»¹ý²¢Ã»Óз¢ÏÖ¿Í»§¶Ë»úÆ÷²»ÄÜÕý³£Á¬½ÓÊý¾Ý¿âµÄÇé¿ö¡£
Oracle¹ØÓÚTNS-12502´íÎóµÄ½âÊÍ:
Error: ORA-12502 / TNS-12502
Text: TNS:listener received no CONNECT_DATA from client
Cause: No CONNECT_DATA was ......