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
Ïà¹ØÎĵµ£º
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 ......
×î½ü·¢ÏÖÒ»¸öÎÊÌ⣬һ¸ö9iÅÜÔÚredhat5µÄ£¬¾ÓÈ» select sysdate from dual ³öÀ´µÄʱ¼äºÍʵ¼Êʱ¼ä²îÁ˼¸·ÖÖÓ£¬ÒòΪ»ùÓÚÕâ¸öoracleµÄϵͳʱ¼äÕýÈ·ÐÔ»¹ÊÇÓеãÒªÇóµÄ¡£ËùÒÔÖ»ÄÜ #date -s 2010-2-10 8:55:00 ÁË£¬ÔÙ#clock -w дÈëCOMS ×¢ÒâÐÞ¸Äʱ¼äµÃÔÚrootÏ¡£
ÔÚϵͳÆô¶¯Ê±£¬Linux²Ù×÷ϵͳ½«Ê±¼ä´ÓCMOSÖжÁµ½ÏµÍ³Ê ......
select p.spid,
a.serial#,
c.object_name,
b.session_id,
b.oracle_username,
b.os_user_name
from v$proces ......
·½·¨Ò»£º
1) ²é¿´·þÎñÆ÷¶Ë×Ö·û¼¯£º &nbs ......