oracleѧϰ£¨¼òµ¥²éѯ£©
£¨1£©²éѯC01¿Î³Ì³É¼¨²»ÎªNullµÄѧÉúµÄÐÕÃûºÍ³É¼¨¡£
·ÖÎö£ºÒòÎªÉæ¼°µ½¿Î³Ì³É¼¨ºÍѧÉúÐÕÃû£¬ÐèÒª¶Ôstudent±íºÍsc±í½øÐÐÁ¬½Ó¡£
´úÂ룺
select sname,grade from student,sc where student.sno=sc.sno and cno='C01' and grade is not null;
½á¹û£º
SNAME GRADE
-------------------- ---------------------------------------
¸ðÁé 68
ÔÀÁÖÔÂ 60
¼§Ê¤¿¡ 54
ÂíÔ´ &n
Ïà¹ØÎĵµ£º
ÉÏһƪÎÄÕÂдÁËÒ»¸öoracleµÄÒ»¸öÐÐתÁеÄÀý×Ó£¬ÀïÃæÓõ½ÁËoracleÖÐÖØÒªµÄº¯Êý decode,ÕâÆªÎÄÕ¾ÍÀ´¼òµ¥µÄѧϰÕâ¸öº¯Êý
DECODEº¯ÊýºÍÎÒÃÇÓïÑԽṹÖеÄÌõ¼þÓï¾ä£¨IF£©ÏàËÆ¡£Ëü½«ÊäÈëÊýÖµÓ뺯ÊýÖеIJÎÊýÁбíÏà±È½Ï£¬¸ù¾ÝÊäÈëÖµ·µ»ØÒ»¸ö¶ÔÓ¦Öµ¡£
DECODEº¯ÊýÏ൱ÓÚÒ»Ìõ¼þÓï¾ä(IF).Ëü½«ÊäÈëÊýÖµÓ뺯ÊýÖеIJÎÊýÁбíÏà±È½Ï£¬¸ù¾ÝÊ ......
OracleÊý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏ൱ÓÚoracleÊý¾Ý»¹ÔÓ뱸·Ý¡£expÃüÁî¿ÉÒÔ°ÑÊý¾Ý´ÓÔ¶³ÌÊý¾Ý¿â·þÎñÆ÷µ¼³öµ½±¾µØµÄdmpÎļþ£¬impÃüÁî¿ÉÒÔ°ÑdmpÎļþ´Ó±¾µØµ¼Èëµ½Ô¶´¦µÄÊý¾Ý¿â·þÎñÆ÷ÖС£ÀûÓÃÕâ¸ö¹¦ÄÜ¿ÉÒÔ¹¹½¨Á½¸öÏàͬµÄÊý¾Ý¿â£¬Ò»¸öÓÃÀ´²âÊÔ£¬Ò»¸öÓÃÀ´ÕýʽʹÓá£
Ö´Ðл·¾³£º¿ÉÒÔÔÚSQLPLUS.EXE»òÕßDOS£¨ÃüÁîÐУ ......
´¥·¢Æ÷µÄÀàÐÍÓÐ:
¡¡¡¡´¥·¢Æ÷ÀàÐÍ£º
¡¡¡¡1¡¢ Óï¾ä´¥·¢Æ÷
¡¡¡¡2¡¢ Ðд¥·¢Æ÷
¡¡¡¡3¡¢INSTEAD OF´¥·¢
¡¡¡¡4¡¢ ϵͳÌõ¼þ´¥·¢Æ÷
¡¡¡¡5¡¢ Óû§Ê¼þ´¥·¢Æ÷
Óï¾ä¼¶´¥·¢Æ÷.(Óï¾ä¼¶´¥·¢Æ÷¶Ôÿ¸öDMLÓï¾äÖ´ÐÐÒ»´Î)
ÊÇÔÚ±íÉÏ»òÕßijЩÇé¿öϵÄÊÓͼÉÏÖ´Ð ......
ÔÚoracle°²×°Ä¿Â¼$HOME/network/adminÏ£¬¾³£¿´µ½sqlnet.ora tnsnames.ora
listener.oraÕâÈý¸öÎļþ£¬³ýÁËtnsnames.ora£¬ÆäËûÁ½¸öÎļþÏêϸµÄÓÃ;ºÜ¶àÈ˶¼²»Ì«Á˽⡣
sqlnet.ora ÓÃÔÚoracle client¶Ë£¬ÓÃÓÚÅäÖÃÁ¬½Ó·þÎñ¶ËoracleµÄÏà¹Ø²ÎÊý.
tnsnames.ora ÓÃÔÚoracle
client¶Ë£¬Óû§ÅäÖÃÁ¬½ÓÊý¾Ý¿âµÄ±ðÃû²ÎÊý,¾ÍÏñÏµÍ³Ö ......
ÎÒÏë×î³õѧϰÊý¾Ý¿âʱ¶¼ÊÇÒÔstudent±í¡¢course±íºÍsc±íΪÀýµÄ°É
Ê×ÏÈ´´½¨ÕâÈýÕÅ±í£º±ØÒªÊ±¿ÉÖØÐ´´½¨Óû§¼°ÃÜÂë²¢µÇ½
»·¾³£ºoracle 10g
declare
vcnt number;
begin
select count(*) into vcnt from user_tables where table_name='SC';
If vcnt = 1 Then
Execute immedi ......