Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PL/SQL±í


/*
PL/SQL±í---table()º¯ÊýÓ÷¨£º
ÀûÓÃtable()º¯Êý£¬ÎÒÃÇ¿ÉÒÔ½«PL/SQL·µ»ØµÄ½á¹û¼¯´úÌætable¡£
oracleÄÚ´æ±íÔÚ²éѯºÍ±¨±íµÄʱºòÓõıȽ϶࣬ËüµÄËÙ¶ÈÏà¶ÔÎïÀí±íÒª¿ì¼¸Ê®±¶¡£
simple example£º
1¡¢table()½áºÏÊý×飺
*/
create or replace type t_test as object(
id integer,
rq date,
mc varchar2(60)
);
create or replace type t_test_table as table of t_test;
create or replace function f_test_array(n in number default null) return t_test_table
as
v_test t_test_table := t_test_table();
begin
for i in 1 .. nvl(n,100) loop
v_test.extend();
v_test(v_test.count) := t_test(i,sysdate,'mc'||i);
end loop;
return v_test;
end f_test_array;
/
select * from table(f_test_array(10));
select * from the(select f_test_array(10) from dual);
/*
2¡¢table()½áºÏPIPELINEDº¯Êý£º
*/
create or replace function f_test_pipe(n in number default null) return t_test_table PIPELINED
as
v_test t_test_table := t_test_table();
begin
for i in 1 .. nvl(n,100) loop
pipe row(t_test(i,sysdate,'mc'||i));
end loop;
return;
end f_test_pipe;
/
select * from table(f_test_pipe(20));
select * from the(select f_test_pipe(20) from dual);
/*
3¡¢table()½áºÏϵͳ°ü£º
*/
create table test (id varchar2(20));
insert into test values('1');
commit;
explain plan for select * from test;
select * from table(dbms_xplan.display);


Ïà¹ØÎĵµ£º

SQL2005ºÍ(Excel |access)Ö®¼äµÄÊý¾Ýµ¼Èëµ¼³ö


Sql´úÂë
--²ÉÓÃSQLÓï¾äʵÏÖsql2005ºÍExcel Êý¾ÝÖ®¼äµÄÊý¾Ýµ¼Èëµ¼³ö£¬ÔÚÍøÉÏÕÒÀ´Ò»--Ï£¬ÊµÏÖ·½·¨ÊÇÕâÑùµÄ£º    
  
  
--Excel---->SQL2005  µ¼È룺    
  
  
select * into useinfo from O ......

sqlÀàÐÍת»»º¯ÊýcastºÍconvert

¼ò½é£º
        Êý¾ÝÀàÐÍת»»¿ÉÒÔͨ¹ýCAST()ºÍCONVERT()º¯ÊýÀ´ÊµÏÖ¡£´ó¶àÊýÇé¿öÏ£¬ÕâÁ½¸öº¯ÊýÊÇÖصþµÄ£¬ËüÃÇ·´Ó³ÁËSQLÓïÑÔµÄÑÝ»¯ÀúÊ·¡£ÕâÁ½¸öº¯ÊýµÄ¹¦ÄÜÏàËÆ£¬²»¹ýËüÃǵÄÓï·¨²»Í¬¡£ËäÈ»²¢·ÇËùÓÐÀàÐ͵ÄÖµ¶¼ÄÜת±äΪÆäËûÊý¾ÝÀàÐÍ£¬µ«×ܵÄÀ´Ëµ£¬ÈκοÉÒÔת»»µÄÖµ¶¼¿ÉÒÔÓüòµ¥µÄº¯ÊýʵÏÖ× ......

sqlÓï¾äÓÅ»¯

²Ù×÷·ûÓÅ»¯
IN ²Ù×÷·û
ÓÃINд³öÀ´µÄSQLµÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ׶®£¬Õâ±È½ÏÊʺÏÏÖ´úÈí¼þ¿ª·¢µÄ·ç¸ñ¡£
µ«ÊÇÓÃINµÄSQLÐÔÄÜ×ÜÊDZȽϵ͵ģº
    Êý¾Ý¿âÊÔͼ½«Æäת»»³É¶à¸ö±íµÄÁ¬½Ó£¬Èç¹ûת»»²»³É¹¦ÔòÏÈÖ´ÐÐINÀïÃæµÄ×Ó²éѯ£¬ÔÙ²éѯÍâ²ãµÄ±í¼Ç¼£¬Èç¹ûת»»³É¹¦ÔòÖ±½Ó²ÉÓöà¸ö±íµÄÁ¬½Ó·½Ê½²éѯ¡£Óɴ˿ɼû ......

SQLÁ·Ï°

father±í   son±í    
fid fname   sid sname fid height money
1 a   100 s1 1 1.7 7000
2 b   101 s2 2 1.6 8000
3 c   102&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ