ORACLE PL/SQL ¼¯ºÏѧϰ±Ê¼Ç(¶þ)
Èý¡¢Ç¶Ì×±íµÄʹÓ÷½·¨
1¡¢½«Ç¶Ì×±í¶¨ÒåΪPL/SQLµÄ³ÌÐò¹¹Ôì¿é
TYPE type_name IS TABLE OF element_type[NOT NULL];
ÈçÏÂÀýËùʾ£º
DECLARE
-- Define a nested table of variable length strings.
TYPE card_table IS TABLE OF VARCHAR2(5 CHAR);
-- Declare and initialize a nested table with three rows.
cards CARD_TABLE := card_table(NULL,NULL,NULL);
BEGIN
-- Print title.
dbms_output.put_line(
'Nested table initialized as nulls.');
dbms_output.put_line(
'----------------------------------');
-- Loop through the three records.
FOR i IN 1..3 LOOP
-- Print the contents.
dbms_output.put ('Cards Varray ['||i||'] ');
dbms_output.put_line('['||cards(i)||']');
END LOOP;
-- Assign values to subscripted members of the varray.
cards(1) := 'Ace';
cards(2) := 'Two';
cards(3) := 'Three';
-- Print title.
dbms_output.put (CHR(10)); -- Visual line break.
dbms_output.put_line(
'Nested table initialized as Ace, Two and Three.');
dbms_output.put_line(
'-----------------------------------------------');
-- Loop through the three records to print the varray contents.
FOR i IN 1..3 LOOP
dbms_output.put_line('Cards ['||i||'] '
|| '['||cards(i)||']');
END LOOP;
END;
/
2¡¢½«Ç¶Ì×±íÀàÐͶ¨ÒåºÍÓÃ×÷PL/SQLµÄ¶ÔÏóÀàÐÍ
CREATE OR REPLACE TYPE type_name
AS TABLE OF element_type [NOT NULL];
ÈçÏÂÀýËùʾ£º
-- Define a varray of four rows of variable length strings.
CREATE OR REPLACE TYPE card_unit_varray
AS VARRAY(13) OF VARCHAR2(5 CHAR);
/
-- Define a varray of four rows of variable length strings.
CREATE OR REPLACE TYPE card_suit_varray
AS VARRAY(4) OF VARCHAR2(8 CHAR);
/
-- Define a table of variable length strings.
CREATE OR REPLACE TYPE card_deck_table
AS TABLE OF VARCHAR2(17 CHAR);
/
DECLARE
-- Define a counter to manage 1 to 52 cards in a deck.
counter INTEGER
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
select decode('X','Q','±äÁ¿1','±äÁ¿2') from dual
¡¡select sysdate,to_char(sysdate,’yyyy-mm-dd hh24:mi:ss’) from dual
¡¡
¡¡select to_date(’2003-10-17 21:15:37’,’yyyy-mm-dd hh24:mi:ss’) from dual
ÈÕÆÚ¸ñʽ²ÎÊý º¬Òå˵Ã÷
D Ò»ÖÜÖеÄÐÇÆÚ¼¸
DAY ÌìµÄÃû ......
¡¡¡¡Ò»¡¢Ê²Ã´ÊÇMTS
¡¡¡¡MTS = Multi-Threaded ServerMTSÊÇORACLE SERVERµÄÒ»¸ö¿ÉÑ¡µÄÅäÖÃÑ¡Ôñ£¬ÊÇÏà¶ÔDEDICATE·½Ê½¶øÑÔ£¬Ëü×î´óµÄÓŵãÊÇÔÚÒÔ²»ÓÃÔö¼ÓÎïÀí×ÊÔ´(ÄÚ´æ)µÄǰÌáÏÂÖ§³Ö¸ü¶àµÄ²¢·¢µÄÁ¬½Ó¡£Joseph C.JohnsonÒԲ͹ݸø³öÒ»¸öMTSµÄÐÎÏóµÄ±ÈÓ÷
¡¡¡¡¼ÙÉèORACLEÊÇÒ»¼Ò²Í¹Ý£¬µ±Äã×ß½øÒ»¼Ò²Í¹ÝʱÄã¸Ð¾õ×îÊæ·þµÄ·þÎñ·½Ê½¾ÍÊ ......
½¨±í
create table users(
id number(4) primary key,
username varchar2(10),
password varchar2(10)
)
²éѯ±í²¢½âËø±í(¼´¿ÉÒÔµã»÷ÊäÈë¿òÏÂÃæµÄ"Ëø"ͼ±ê¹¤¾ß, ¼´"Edit data")
select * from users for update
ɾ³ý±íÖжàÓàµÄÁÐ
alter table mobilephone drop column mobiletype
×ªÔØ
------------------- ......