oracle ´æ´¢¹ý³ÌʵÀý
/*²»´øÈκβÎÊý´æ´¢¹ý³Ì(Êä³öϵͳÈÕÆÚ)*/
create or replace procedure output_date is
begin
dbms_output.put_line(sysdate);
end output_date;
/*´ø²ÎÊýinºÍoutµÄ´æ´¢¹ý³Ì*/
create or replace procedure get_username(v_id in number,v_username out varchar2)
as
begin
select username into v_username from tab_user where id = v_id; --±äÁ¿¸³Öµ
exception
when no_data_found then
raise_application_error(-20001,'ID²»´æÔÚ!');
end get_username;
Ïà¹ØÎĵµ£º
extent--×îС¿Õ¼ä·ÖÅ䵥λ --tablespace management
block --×îСi/oµ¥Î» --segment management
create tablespace james
datafile '/export/home/oracle/oradata/james.dbf'
size 100M ¡¡¡¡¡¡¡¡¡¡¡¡--³õʼµÄÎļþ´óС¡¡
autoextend On¡¡¡¡¡¡¡¡ --×Ô¶¯Ôö³¤
next 10M¡ ......
JoinÊÇÒ»ÖÖÊÔͼ½«Á½¸ö±í½áºÏÔÚÒ»ÆðµÄν´Ê£¬Ò»´ÎÖ»ÄÜÁ¬½Ó2¸ö±í£¬±íÁ¬½ÓÒ²¿ÉÒÔ±»³ÆΪ±í¹ØÁª¡£ÔÚºóÃæµÄÐðÊöÖУ¬ÎÒÃǽ«»áʹÓÔrow source”À´´úÌ攱픣¬ÒòΪʹÓÃrow source¸üÑϽ÷һЩ£¬²¢ÇÒ½«²ÎÓëÁ¬½ÓµÄ2¸örow source·Ö±ð³ÆΪrow source1ºÍrow source 2¡£Join¹ý³ÌµÄ¸÷¸ö²½Öè¾³£ÊÇ´®ÐвÙ×÷£¬¼´Ê¹Ïà¹ØµÄr ......
declare cursor myCursor is select * from ±íÃû;
myRow myCursor%rowtype;
begin
open myCursor;
loop
fetch myCursor into myRow;
exit when myCursor%notfound;
--ÒªÖ´ÐеÄSQLÓï¾ä
end loop;
end; ......
·ÖÒ³²éѯ¸ñʽ£º
SELECT * from
(
SELECT A.*, ROWNUM RN
from (SELECT * from TABLE_NAME) A
WHERE ROWNUM <= 40
)
WHERE RN >= 21
ÆäÖÐ×îÄÚ²ãµÄ²éѯSELECT * from TABLE_NAME±íʾ²»½øÐзҳµÄÔʼ²éѯÓï¾ä¡£ROWNUM <= 40ºÍRN >= 21¿ØÖÆ·ÖÒ³²éѯµÄÿҳµÄ·¶Î§¡£
ÉÏÃæ¸ø³öµÄÕâ¸ö·ÖÒ ......