Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PL/SQLѧϰ±Ê¼ÇÈý


1.Ìõ¼þ¿ØÖÆ
1.1 if .. then .. end if
if Ìõ¼þ then
    Óï¾ä¶Î£»
end if;
1.2 if .. then .. else .. end if
if Ìõ¼þ then
    Óï¾ä¶Î£»
else 
    Óï¾ä¶Î£»
end if;
1.3 ifǶÌ×
2.Ñ­»·¿ØÖÆ
2.1 loop .. exit .. end loop
loop  
    Ñ­»·Óï¾ä¶Î;
    if Ìõ¼þÓï¾ä then
       Óï¾ä¶Î; 
       exit;
    else
       Óï¾ä¶Î;
    end if
end loop;
2.2 loop .. exit .. when .. end loop
loop
    Óï¾ä¶Î;
    exit when Ìõ¼þÓï¾ä;
end loop;
2.3 while .. loop .. end loop
while Ìõ¼þ loop
     Óï¾ä¶Î;
end loop;
2.4 for .. in .. loop.. end
for Ñ­»·±äÁ¿ in [reverse] Ñ­»·Ï½ç..Ñ­»·ÉϽç loop
     Óï¾ä¶Î;
end loop;
×¢Ò⣺reverse±íʾ´ÓºóÍùÇ°Ñ­»·£¬Ñ­»·ÉÏϽ粻±ä
ʾÀý£º
set serveroutput on
declare
  i integer:=0;
begin
  for i in reverse 1..10 loop
    dbms_output.put_line('i µÄÖµ£º' || to_char(i));
  end loop;    
end;
Êä³ö˳Ðò£º10 9 8 7 6 5 4 3 2 1


Ïà¹ØÎĵµ£º

SQL Server±¨´íChinese_PRC_90_CI_AS

SQL Server 2005±¨ÁËÕâô¸ö´í£ºCannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "Chinese_PRC_90_CI_AS" in the like operation.
ºó²éÖ¤£¬ÕâÊÇÓÉÓÚÁ½¸ö×ö±È½ÏµÄÁеÄÅÅÐò·½Ê½²»Í¬£¬ÖÐÎÄÓкܶàÖÖÅÅÐò·½Ê½£¬¶ÔÓ¦ÈçÏ£º
ÖÐÎÄ£¨Ïã¸ÛÌرðÐÐÕþÇø£©
Chinese_Hong_Kong_Stroke_90_CI_AS
ÖÐÎÄ£¨Ïã¸ÛÌرðÐ ......

sql server·ÃÎÊÔ¶³ÌÊý¾Ý¿â

--´´½¨Á´½Ó·þÎñÆ÷
exec sp_addlinkedserver   'ITSV ', ' ', 'SQLOLEDB ', 'Ô¶³Ì·þÎñÆ÷Ãû»òipµØÖ· '
exec sp_addlinkedsrvlogin 'ITSV ', 'false ',null, 'Óû§Ãû ', 'ÃÜÂë '
--²éѯʾÀý
select * from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--µ¼ÈëʾÀý
select * into ±í from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--ÒÔºó²» ......

sqlº¯Êý¡¡

1¡¢ISNULL ( check_expression , replacement_value )
²ÎÊý
check_expression
½«±»¼ì²éÊÇ·ñΪ NULLµÄ±í´ïʽ¡£check_expression ¿ÉÒÔÊÇÈκÎÀàÐ͵ġ£
replacement_valueÔÚ check_expressionΪNULLʱ½«·µ»ØµÄ±í´ïʽ¡£replacement_value ±ØÐëÓë check_expresssion ¾ßÓÐÏàͬµÄÀàÐÍ¡£
·µ»ØÀàÐÍ
·µ»ØÓë check_expression Ï ......

ÁíÀà¼òµ¥µÄSQLÊý¾Ý¿â¸ÄÃû·½·¨

°ÑOldÊý¾Ý¿â¸ÄΪNewÊý¾Ý¿â
1.´ò¿ª“ÆóÒµ¹ÜÀíÆ÷”ÕÒµ½ OldÊý¾Ý¿â£­£­¡·ÓÒ¼ü£­£­¡·ËùÓÐÈÎÎñ£­£­¡··ÖÀëÊý¾Ý¿â
2.µ½C:\Program Files\Microsoft SQL Server\MSSQL\DataÏÂÕÒµ½Old_Data.mdfºÍOld_log.ldf°ÑOld_Data»»³ÉÄãÏëÒªµÄÃû×ÖÀýÈçNew.mdf¡¢New.ldf
3.µ½ÆóÒµ¹ÜÀíÆ÷£¬ÕÒµ½ Êý¾Ý¿â £­£­¡·ÓÒ¼ü£­£­¡·ËùÓÐÈÎÎñ£­£­¡ ......

PL/SQLѧϰ±Ê¼Ç¶þ


1.³£Á¿
¶¨ÒåÓï·¨¸ñʽ£º
³£Á¿Ãû constant ÀàÐͱêʶ·û [not null]:=Öµ;
È磺PI constant number(9):=3.1415;
2.»ù±¾Êý¾ÝÀàÐͱäÁ¿
»ù±¾Êý¾ÝÀàÐÍ
number  Êý×ÖÐÍ
int ÕûÊýÐÍ
pls_integer ÕûÊýÐÍ£¬²úÉúÒç³öʱ³öÏÖ´íÎó
binary_integer ÕûÊýÐÍ£¬±íʾ´ø·ûºÅµÄÕûÊý
char ¶¨³¤×Ö·ûÐÍ£¬×î´ó255¸ö×Ö·û
varchar2 ±ä³¤× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ