±±´óÇàÄñoracleѧϰ±Ê¼Ç23 24
×Ó³ÌÐò ÃüÃûµÄpl/sql¿é
create procedure ¹ý³ÌÃû [²ÎÊý1 in|out|in out¡]
¾Ö²¿±äÁ¿ÉùÃ÷
Ö´ÐÐÓï¾ä
in
out
in out
¹ý³ÌÃû(²ÎÊýÀï±í); create or replace
procedure add123 as
i integer;
j integer;
begin
i:=1;
j:=2;
dbms_output.put_line(i+j);
end;
execute add123;
×¢ÒâÕâÀï´´½¨¹ý³ÌºÍÖ´Ðв»ÄÜ·ÅÔÚÒ»Æ𣬷ñÔÚexecute»áËæ¹ý³Ì¶¨ÒåдÈë¹ý³ÌÖУ¬sql developÖвâÊÔÈç´Ë£¬²»ÖªµÀΪʲô¡£
CREATE OR REPLACE
PROCEDURE QUERYSTUNAME
( stuid STUDENT.STU_ID%TYPE)
AS
sname student.stu_name%type;
ssex student.stu_sex%type;
BEGIN
select stu_name,stu_sex into sname,ssex from student where stu_id = stuid;
dbms_output.put_line(sname||ssex);
EXCEPTION
when No_Data_Found then
dbms_output.put_line('no data found');
when Too_Many_Rows then
dbms_output.put_line('to many rows');
when others then
dbms_output.put_line('other error');
END QUERYSTUNAME;
execute querystuname(1); º¯Êý
create function º¯ÊýÃû [²ÎÊýÁбí]
¾Ö²¿±äÁ¿ÉùÃ÷
¿ÉÖ´ÐÐÓï¾ä
end;
Á½ÖÖ·ÃÎÊ·½Ê½
sqlÓï¾ä
½ö½ÓÊÜin²ÎÊý£¬·µ»ØÖµÀàÐͲ»ÄÜ´ø¾«¶È¡£
CREATE OR REPLACE
FUNCTION GETNAME(stuid varchar)
RETURN VARCHAR AS
stuname student.stu_name%type;
BEGIN
select stu_name into stuname from student where stu_id = stuid;
RETURN stuname;
EXCEPTION
when No_Data_Found then
dbms_output.put_line('no data found');
when Too_Many_Rows then
dbms_output.put_line('to many rows');
when others then
dbms_output.put_line('other error');
END GETNAME;
declare
begin
dbms_output.put_line(getname(1));
end;
¹ý³Ì
º¯Êý
×÷Ϊpl/sqlÓï¾äÖ´ÐÐ
×÷Ϊ±í´ïʽһ²¿·Öµ÷ÓÃ
ÔÚ¹æ¸ñ˵Ã÷Öв»°üº¬return×Ó¾ä
±ØÐëÔÚ¹æ¸ñ˵Ã÷Öаüº¬return×Ó¾ä
¿ÉÒÔ·µ»ØÈκÎÖµ
·µ»Øµ¥Öµ
¿ÉÒÔ°üº¬returnÓï¾ä£¬µ«ÊDz»ÄÜÓÃÓÚ·µ»ØÖµ
±ØÐë°üº¬returnÓï¾ä
Ïà¹ØÎĵµ£º
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* ´Ë´¦²åÈëÀàÐÍ˵Ã÷¡£
* ´´½¨ÈÕÆÚ£º(2001/11/30 14:55 ......
1.»ù±¾½á¹¹
CREATE OR REPLACE PROCEDURE ´æ´¢¹ý³ÌÃû×Ö
(
²ÎÊý1 IN NUMBER,
²ÎÊý2 IN NUMBER
) IS
±äÁ¿1 INTEGER :=0;
±äÁ¿2 DATE;
BEGIN
END ´æ´¢¹ý³ÌÃû×Ö
2.SELECT INTO STATEMENT
½«select²éѯµÄ½á¹û´æÈëµ½±äÁ¿ÖУ¬¿ÉÒÔͬʱ½«¶à¸öÁд洢¶à¸ö±äÁ¿ÖУ¬±ØÐëÓÐÒ»Ì ......
oracle³£ÓÃÊý¾ÝÀàÐÍ
½ñÌìͬÊÂÎÊЩÊý¾ÝÀàÐ͵ÄÎÊÌ⣬ÓеĻ¹ÕæÓеã¼Ç²»ÇåÁË£¬ÓÚÊǾͼòµ¥×ܽáϳ£ÓõÄÊý¾ÝÀàÐÍÒÔ±¸ÈÕºó²éÓÃ
1¡¢Char
¶¨³¤¸ñʽ×Ö·û´®£¬ÔÚÊý¾Ý¿âÖд洢ʱ²»×ãλÊýÌî²¹¿Õ¸ñ£¬ËüµÄÉùÃ÷·½Ê½ÈçÏÂCHAR(L)£¬LΪ×Ö·û´®³¤¶È£¬
ȱʡΪ1£¬×÷Ϊ±äÁ¿×î´ó32767¸ö×Ö·û£¬×÷ΪÊý¾Ý´æ´¢ÔÚORACLE8ÖÐ×î´óΪ2000¡£²»½¨ÒéʹÓ㬻ᴠ......
ORACLE 10G for RHEL AS 4 °²×°
ÑéÖ¤°²×°:¼ì²éORACLEËùÐèµÄ³ÌÐòÊÇ·ñ°²×°¾ùÒÑ°²×°(»ò¸ü¸ß°æ±¾)
compat-db-4.1.25-9.i386.rpm
compat-gcc-32-3.2.3-47.3.i386.rpm
compat-gcc-32-c++-3.2.3-47.3.i386.rpm
compat-libstdc++-33-3.2.3-47.3.i386.rpm
compat-oracle-rhel4-1.0-5.i386.rpm
gcc-3.4.3-9.EL4.i386.rpm
gli ......
±³¾°£ºÔÚwindows2003serverÉÏ°²×°ÁËOracle9.2.0.1.0£¬ÏÖ´òË㽫ÆäÉý¼¶µ½9.2.0.8°æ±¾£¬²¢´òÉÏ×îÐµİ²È«²¹¶¡April2008°æ¡£
1.Éý¼¶oracle£¨administratorÓû§È¨ÏÞ£©
(1)µ½metalinkÏÂÔØÉý¼¶Ñ¹Ëõ°ü£¬patchºÅΪ4547809£¬Ñ¹Ëõ°üÃû³ÆΪ p4547809_92080_WINNT.zip£¬for windows 32bit¡£
(2)½âѹËõzip£¬Ï±߰üº¬Ò»¸ö ......