³õѧPL/SQLµÄһЩ»ù±¾ÖªÊ¶
1,Ò»¸öÍêÕûµÄPL/SQL Óï¾äÓÉÈý¸ö²¿·Ö×é³É¡£
declare
ÉùÃ÷²¿·Ö£¬¶¨Òå±äÁ¿£¬Êý¾ÝÀàÐÍ£¬Òì³££¬¾Ö²¿×Ó³ÌÐòµÈ¡£
begin
Ö´Ðв¿·Ö£¬ÊµÏÖ¿éµÄ¹¦ÄÜ¡£
Exception
Òì³£´¦Àí²¿·Ö£¬´¦Àí³ÌÐòÖ´Ðйý³ÌÖвúÉúµÄÒì³£¡£
end;
Ö´Ðв¿·ÖÊDZØÐèµÄ£¬¶øÉùÃ÷²¿·ÖºÍÒì³£²¿·ÖÊÇ¿ÉÑ¡µÄ¡£
¿ÉÒÔÔÚÒ»¸ö¿éµÄÖ´Ðв¿·Ö»òÒì³£´¦Àí²¿·ÖǶÌ×ÆäËüµÄPL/SQL¿é
ËùÓеÄPL/SQL ¿é¶¼ÊÇÒÔ"end;"½áÊøµÄ¡£
2£¬¶¨ÒåÒ»¸ö°üº¬ÉùÃ÷²¿·Ö£¬Ö´Ðв¿·ÖºÍÒì³£´¦Àí²¿·ÖµÄPL/SQL¿é
declare
v_bookName varchar2(50);
begin
select bookname into v_bookName from Book where BookId=1;
DBMS_output.put_line(v_bookName);
Exception
when no_Data_Found then
DBMS_output.put_line('there is not such a bookname');
end;
×¢Ò⣺ÈôÒªÔÚSQL*PLus»·¾³Öп´µ½DBMS_OutPut.Put_Line·½·¨µÄÊä³ö½á¹û£¬±ØÐ轫»·¾³±äÁ¿ServeroutputÉèÖÃΪon
SQL>set serveroutput on
3, %TYPEÓë%ROWTYPE
Èç¹ûÒª¶¨ÒåÒ»¸öÀàÐÍÓëij¸ö±äÁ¿µÄÊý¾ÝÀàÐÍ»òÊý¾Ý±íÖÐij¸öÁеÄÊý¾ÝÀàÐÍÒ»Ö£¨²»ÖªµÀ¸Ã±äÁ¿»òÁеÄÊý¾ÝÀàÐÍ£©µÄ±äÁ¿£¬
¿ÉÒÔÀûÓÃ%TypeʵÏÖ¡£
Èç¹ûÒª¶¨ÒåÒ»¸öÓëÊý¾Ý¿âÖÐij¸ö±í½á¹¹Ò»ÖµļǼÀàÐ͵ıäÁ¿£¬¿ÉÒÔÀûÓÃ%rowtypeʵÏÖ¡£
ÀýÈ磺
declare
v_book book.bookname%Type;
&
Ïà¹ØÎĵµ£º
˼·:SQLÀᄀ¿ÉÄܵIJÉÓÃÁ½¸öÒýºÅ±ÕºÏ±äÁ¿;¶Ô±äÁ¿ÖеÄÒýºÅתÒå;¶Ô²»ÄܲÉÓÃ2¸öÒýºÅ±ÕºÏµÄ±äÁ¿,ÏÈÔ¤ÏÈÅжϱäÁ¿ÀàÐÍ;
·½°¸:
1 ËùÓзÇÊýÖµÔËËã(Èç×Ö·û,¼òµ¥ÊýÖµÐ͵ȵÈ)µÄSQL±äÁ¿¶¼¼ÓÒýºÅ;
2 ËùÓзÇÊýÖµÔËËãµÄSQL±äÁ¿µÄÖµ¶¼²ÉÓÃmagic_quotes_gpc» ......
ËäÈ»ÕâÊÇÎÒÕÒµ½×îÏêϸµÄÅäÖÃÃèÊö£¬µ«Êdz¢ÊÔ»¹ÊÇûÓгɹ¦¡£
1.ÏÂÔØOracle Client Package
.
´Ó
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
ÏÂÔØ
Instant
Client Package – Basic
°ü
(
±ê×¢
:All files
required to run OCI, OCCI, and JDBC-OC ......
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[sp_GetRecordfromPage]
@TableName varchar(350), --±íÃû
@Fields varchar(5000) = '*', --×Ö¶ÎÃû(È«²¿×Ö¶ÎΪ*)
@OrderField varchar(5000), &nbs ......
×°sql 2005ºó¶ÔһЩ¹¦ÄÜ»¹²»ÊǺÜÏ°¹ß£¬±ÈÈçÓÃsaµÇ¼Êý¾Ý¿âÔںܶàµØ·½¶¼»áÓõ½£¬½ñÌì¾ÍsaµÇ¼Êý¾Ý¿âµÄһЩÐÞ¸ÄÓë´ó¼Ò·ÖÏí¡£
1.ÏÈÓÃWINDOWSģʽµÇ½,È»ºóÔÚÊý¾Ý¿â¶¥¶ËÓÒ¼üÊôÐÔ£»Èçͼ1-1£º
2.ÔÚ°²È«ÐÔϵÄWINDOWSģʽ¸ÄΪSQLÓëWINDOWSģʽ£¬ÏÂÃæµÄµÇ½ÉóºËÑ¡Ïî,Ñ¡ÔñΪ‘ÎÞ’£¬µã‘È·¶¨’£»Èçͼ1-2£º
3. ......
ÖÁ½ñδÓгɾͣ¬Éõ¸ÐáÝáå¡£
²¢²»ÊǺÜͻȻµÄÏëѧSQL£¬¶øÊÇÔÚ֮ǰ˵µÄÄÇÑù£¬ÔÚÎÒÈÆÁËÒ»´óȦ֮ºó£¬²ÅÖªµÀ×Ô¼ºÒ²ÊÇÒ»ÎÞËùÖª£¬Í÷ѧÁËÕâô¶àÄê¡£
ÎÒÒ»Ö±ÏëÍÑÀëѧУµÄ½ÌÓýģʽÀ´×Ôѧ£¬È»¶øÎÒ²¢²»³ÐÈÏѧУµÄ½ÌÓý·½Ê½ÊÇÒ»ÎÞËùÓõģ¬ÖÁÉÙѧµ½µÄ¶«Î÷ÊÇʵÔڵġ£´ÓѧУµÄ½Ç¶ÈÀ´¿¼ÂÇ£¬ ......