Oracle ²Ù×÷º¯Êý
º¯Êý£º
1.ʹÓÃCreate Function Óï¾ä´´½¨
2.Óï
·¨£º
Create or replace Function º¯ÊýÃû[²ÎÊýÁбí]
Return Êý¾ÝÀàÐÍ
IS|AS
¾Ö²¿±äÁ¿
Begin
¿ÉÖ´ÐÐÓï¾ä
end£»
3.·ÃÎʺ¯Êý
-ÓÃÁ½ÖÖ·½Ê½½øÐзÃÎÊ
ʹÓÃPL/SQL¿é
ʹÓÃSQLÓï¾ä
-½ö½ÓÊÜIn²ÎÊý
ʾÀý£º
create or replace function
GetName(sNo varchar2)
return varchar Is --²»ÄÜÖ¸¶¨¾«¶È
name
varchar(12);
Begin
select ename into name from emp
where empno=sNo;
return name;
Exception
when
Too_many_rows then
DBMS_output.put_line('·µ»ØÖµ¶àÓàÒ»Ìõ');
when
Others then
DBMS_output.put_line('ÔÚÖ´Ðк¯ÊýGetNameʱ³öÏÖÒâÍâ´íÎó!');
End;
/
µ÷ÓÃ
declare
name varchar(12);
begin
name:=getname('7369');
DBMS_output.put_line('½á¹ûΪ:'||name);
end;
/
Êý¾Ý×ֵ䣺user_source
±àÒëʱ³ö´íµÄÊý¾Ý×Ö
µä£ºuser_errors;
»ò show errors£»
select * from user_source from where
name='GETNAME'; --×¢Òâ´óд
¹ý³ÌÓ뺯Êý
¹ý
³Ì º¯Êý
×÷Ϊ
PL/SQLÓï¾äÖ´ÐÐ &nb
Ïà¹ØÎĵµ£º
ORACLEÓαê
Óα꣺ÈÝÆ÷£¬´æ·Åµ±Ç°SQLÓï¾äÓ°ÏìµÄ¼Ç¼
ËùÓÐDMLÓï¾ä¶¼»áÓõ½Óαê
ÖðÐд¦ÀíÓ°ÏìµÄÐÐÊý
Óαê
¾²Ì¬Óα꣺ÓαêÓëSQLÓï¾äÔÚÔËÐÐǰ¹ØÁª
&nb ......
³ÌÐò°ü
°üÖ÷Ìå/¹æ·¶Ãû×ÖÒ»Ñù
°üÖ÷Ìå/¹æ·¶ÖеĶÔÓ¦²ÎÊý±ØÐëÀàÐͼ°Ãû×ÖÒ»Ñù
Ö»ÄÜʹÓÃÇ¿ÀàÐ͵ÄREFÓαê
´´½¨³ÌÐò°ü¹æ·¶
create or replace package my_pack
is
procedure find_emp_proc(eno emp.empno%type);
function fin ......
OleDbConnectioncon=newOleDbConnection(cnnstr);
try
{
con.Open();
}
catch
{}
OleDbCommandcmd=newOleDbCommand(strSQL,con);
System.Data.OleDb.OleDbDataReaderdr=cmd.ExecuteReader();
while(dr.Read())
{
stringdd=dr["gggg"].ToString();
byte[]ooo=(byte[])dr["hhhh"];
stringstr;
str=Sys ......
SQLµÄÓÅ»¯Ó¦¸Ã´Ó5¸ö·½Ãæ½øÐе÷Õû£º
1.È¥µô²»±ØÒªµÄ´óÐͱíµÄÈ«±íɨÃè
2.»º´æÐ¡ÐͱíµÄÈ«±íɨÃè
3.¼ìÑéÓÅ»¯Ë÷ÒýµÄʹÓÃ
4.¼ìÑéÓÅ»¯µÄÁ¬½Ó¼¼Êõ
5.¾¡¿ÉÄܼõÉÙÖ´Ðмƻ®µÄCost
SQLÓï¾ä£º
ÊǶÔÊý¾Ý¿â(Êý¾Ý)½øÐвÙ×÷µÄΩһ;¾¶£»
ÏûºÄÁË70%~90%µÄÊý¾Ý¿â×ÊÔ´£»¶ÀÁ¢ÓÚ³ÌÐòÉè¼ÆÂß¼£¬Ïà¶ÔÓÚ¶Ô³ÌÐòÔ´´úÂëµÄÓÅ»¯£¬¶ÔSQLÓï¾äµÄÓÅ»¯Ô ......
×î½ü·¢ÏÖÒ»¸öÎÊÌ⣬һ¸ö9iÅÜÔÚredhat5µÄ£¬¾ÓÈ» select sysdate from dual ³öÀ´µÄʱ¼äºÍʵ¼Êʱ¼ä²îÁ˼¸·ÖÖÓ£¬ÒòΪ»ùÓÚÕâ¸öoracleµÄϵͳʱ¼äÕýÈ·ÐÔ»¹ÊÇÓеãÒªÇóµÄ¡£ËùÒÔÖ»ÄÜ #date -s 2010-2-10 8:55:00 ÁË£¬ÔÙ#clock -w дÈëCOMS ×¢ÒâÐÞ¸Äʱ¼äµÃÔÚrootÏ¡£
ÔÚϵͳÆô¶¯Ê±£¬Linux²Ù×÷ϵͳ½«Ê±¼ä´ÓCMOSÖжÁµ½ÏµÍ³Ê ......