ORACLEPL/SQL»ù´¡
ORACLEPL/SQL»ù´¡--ÓαêµÄѧϰÀ´Ô´£º
Óαê×ÖÃæÀí½â¾ÍÊÇÓζ¯µÄ¹â±ê¡£
ÓÃÊý¾Ý¿âÓïÑÔÀ´ÃèÊö£ºÓαêÊÇÓ³ÉäÔÚ½á¹û¼¯ÖÐÒ»ÐÐÊý¾ÝÉϵÄλÖÃʵÌ壬ÓÐÁËÓαêÓû§¾Í¿ÉÒÔ·ÃÎʽá¹û¼¯ÖеÄÈÎÒâÒ»ÐÐÊý¾ÝÁË£¬½«Óαê·ÅÖõ½Ä³Ðк󣬼´¿É¶Ô¸ÃÐÐÊý¾Ý½øÐвÙ×÷£¬ÀýÈçÌáÈ¡µ±Ç°ÐеÄÊý¾ÝµÈµÈ¡£
ÓαêµÄ·ÖÀࣺ
ÏÔʽÓαêºÍÒþʽÓαê
ÏÔʾÓαêµÄʹÓÃÐèÒª4²½£º
1.ÉùÃ÷Óαê
CURSOR mycur(vartype number) is
select emp_no,emp_zc from cus_emp_basic
where com_no = vartype;
2.´ò¿ªÓαê
open mycur(000627) ×¢£º000627:²ÎÊý
3.¶ÁÈ¡Êý¾Ý
fetch mycur into varno,varprice;
4.¹Ø±ÕÓαê
close mycur;
ÓαêµÄÊôÐÔ
oracle ÓαêÓÐ4¸öÊôÐÔ£º %ISOPEN £¬ %FOUND £¬ %NOTFOUND£¬ %ROWCOUNT
%ISOPEN ÅжÏÓαêÊÇ·ñ±»´ò¿ª£¬Èç¹û´ò¿ª%ISOPEN µÈÓÚtrue,·ñÔòµÈÓÚfalse
%FOUND %NOTFOUND ÅжÏÓαêËùÔÚµÄÐÐÊÇ·ñÓÐЧ£¬Èç¹ûÓÐЧ£¬Ôò%FOUNDDµÈÓÚtrue£¬·ñÔòµÈÓÚfalse
%ROWCOUNT ·µ»Øµ±Ç°Î»ÖÃΪֹÓαê¶ÁÈ¡µÄ¼Ç¼ÐÐÊý¡£
ʾÀý£º
set serveroutput on;
declare
varno varchar2(20);
varprice varchar2(20);
CURSOR mycur(vartype number) is
select emp_no,emp_zc from cus_emp_basic
where com_no = vartype;
begin
if mycur%isopen = false then
open mycur(000627);
end if;
fetch mycur into varno,varprice;
while mycur%found
loop
dbms_output.put_line(varno||’,’||varprice);
if mycur%rowcount=2 then
exit;
end if;
fetch mycur into varno,varprice;
end loop;
close mycur;
end;
pl/sql ¼Ç¼ µÄ½á¹¹ºÍcÓïÑÔÖеĽṹÌåÀàËÆ£¬ÊÇÓÉÒ»×éÊý¾ÝÏî¹¹³ÉµÄÂß¼µ¥Ôª¡£
pl/sql ¼Ç¼²¢²»±£´æÔÙÊý¾Ý¿âÖУ¬ËüÓë±äÁ¿Ò»Ñù£¬±£´æÔÙÄÚ´æ¿Õ¼äÖУ¬ÔÚʹÓüǼʱºò£¬ÒªÊ×Ïȶ¨Òå¼Ç¼½á¹¹£¬È»ºóÉùÃ÷¼Ç¼±äÁ¿¡£¿ÉÒÔ°Ñpl/sql¼Ç¼¿´×÷ÊÇÒ»¸öÓû§×Ô¶¨ÒåµÄÊý¾ÝÀàÐÍ¡£
set serveroutput on;
declare
type person is record
(
empno cus_emp_basic.emp_no%type,
Ïà¹ØÎĵµ£º
SQL Server CE 2.0µÄÈ«ÃûÊÇSQL Server 2000 Windows CE Edition version 2.0¡£
Àý×Ó1£º¹«Ë¾ÅÉÈËÈ¥²Ö¿âÑé»õ¡¢µã»õ£¬¿ÉÒÔ°ÑÇ嵥ͬ²½µ½Pocket PCÉÏ£¬È»ºóÔÚ²Ö¿âÀïÃæÖ±½ÓÔÚPPCÉÏÃæupdate£¬»Øµ½¹«Ë¾Ò»Í¬²½¾Í¿ÉÒÔÁË¡£·ñÔò°´ÕÕÔÏÈ×ö·¨£¬ÐèÒªÏÈ´òÓ¡Ò»ÕÅÇåµ¥£¬»ØÀ´ÒÔºóÔÙ¼ÈëÒ»±é¡£
Àý×Ó2£ºÁªÏëÅÉÈËÉÏÃÅÀ´ÐÞµçÄÔ£¬ÒÔÇ°×ÜÊÇ´ ......
ÅäÖÃʹÓà SQL ServerÌṩ³ÌÐò
<configuration>
<system.web> <-- ¸ü¸ÄÌṩ³ÌÐòÅäÖ㺠-->
<membership defaultProvider="AspNetSqlProvider" />
</system.web>
<membership> <--ÅäÖÃÌṩ³ÌÐò -->
<prov ......
ÔÚ×ösqlÌâʱ£¬ÎÒÃÇ×îÅÂÓöµ½Ìõ¼þ¸´ÔӵIJéѯÓï¾ä£¬ÒòΪ´ó¶àʱºòÐèÒªÁ½Èý¸ö×Ó²éѯÀ´ÊµÏÖ£¬
¶ø´ó¶àÊýͬѧ£¬¿ÉÒÔ˵¶¼±È½ÏÅÂ×Ó²éѯµÄ£¬ÒÔÇ°ÎÒÒ²±»ÕâЩÌâĿŪµÄÔÆÀïÎíÀïµÄ£¬
²»¹ý×ö¶àÁËÕâÀàµÄÌâÄ¿ºó·¢ÏÖ£¬ÆäʵҲÓÐÒ»¶¨¹æÂÉ£¬ÎÒÃÇ¿ÉÒÔ×ܽáÒ»Ì×ÊʺÏ×Ô¼ºµÄ·½·¨À´´¦Àí£¬
ÏÂÃæʱÎÒ¶Ô¸ÃÀàÌâÄ¿µÄ´¦Àí·½·¨£º
ÓйºÎï±íÈçÏ£º
ÌâÄ¿£º ²é ......
×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´®ºÍ±í´ïʽִÐв»Í¬µÄÔËËã¡£´ËÀຯÊý×÷ÓÃÓÚCHAR¡¢VARCHAR¡¢ BINARY¡¢ ºÍVARBINARY Êý¾ÝÀàÐÍÒÔ¼°¿ÉÒÔÒþʽת»»ÎªCHAR »òVARCHARµÄÊý¾ÝÀàÐÍ¡£¿ÉÒÔÔÚSELECT Óï¾äµÄSELECT ºÍWHERE ×Ó¾äÒÔ¼°±í´ïʽÖÐʹÓÃ×Ö·û´®º¯Êý¡£
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ ......
SQL SERVER ºÍEXCELµÄÊý¾Ýµ¼Èëµ¼³ö
1¡¢ÔÚSQL SERVERÀï²éѯExcelÊý¾Ý:
-- ======================================================
SELECT *
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\book1.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...[Sheet1$]
ÏÂÃæÊǸö²éÑ ......