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

×Ô¼ºÐ´µÄoracle´æ´¢¹ý³Ì»áÓõ½

create or replace procedure prc_statistic_declare(table_name varchar2 ,table_name_pass varchar2 ,not_exist varchar2,not_exist_record varchar2)
--eg:'t_statistic_bianyuanhu_month',t_statistic_bianyuanhu_month,('YEAR','STATISTIC_ID')','YESR'
is
   v_sql_column varchar2(1000);
   v_sql_record varchar2(1000);
   get_declare  varchar2(9000);
begin
  declare
 
     type v_column is record(c_value varchar2(200));
     dec_column v_column;
    
     type my_cursor is ref cursor;
     v_statistic_cur my_cursor;
    
  begin
     v_sql_column :=' select column_name  from user_tab_columns c WHERE c.TABLE_name = upper('||table_name||')
                      and c.column_name not in   ('||not_exist||')';
     dbms_output.put_line(v_sql_column);
     get_declare :=' ';
     open v_statistic_cur for v_sql_column;
     fetch v_statistic_cur into dec_column;
     while v_statistic_cur%found loop----------»ñµÃdeclareÊý×éÓï¾ä
            get_declare :='type '||dec_column.c_value||'  is table of '||table_name_pass||'.'||dec_column.c_value||'%type index by pls_integer;';
            dbms_output.put_line('type DEC_'||dec_column.c_value||'  is table of '||table_name_pass||'.'||dec_column.c_value||'%type index by pls_integer;');
            fetch v_statistic_cur into dec_column; 
     end loop;        
   


Ïà¹ØÎĵµ£º

OracleÊý¾Ý¿âµÄµ¼Èëµ¼³ö

oracleÊý¾Ý¿âµÄµ¼ÈëÓëµ¼³öÊÇ×öΪһÃûʵʩ¹¤³Ìʦ»òά»¤¹¤³Ìʦÿ¾­³£Òª×öµÄ¹¤×÷¡£µ±Êý¾Ý¿â½á¹¹ÐèÒª×ö±ä»¯µÄʱºò£¬ÎÒÃÇÒ»°ãÏȽ«Êý¾Ý×ö±¸·Ý£¬´ËʱÎÒÃÇÐèҪʹÓõ½OracleµÄµ¼³ö¹¦ÄÜ¡£µ±ÎÒÃÇÔÚ×öµ¼ÈëµÄʱºò³ö´í»òÕßÎÒÃǵÄÊý¾ÝÔâµ½´íÎóɾ³ýµÄʱºò£¬ÎÒÃÇÐèÒª»Ö¸´Êý¾Ý¿â£¬ÄÇÎÒÃÇÐèҪʹÓõ½µ¼ÈëµÄ¹¦ÄÜ¡£ÏÖÔÚÒ²Óкܶ๦ÄÜÄܹ»°ïÎÒÃÇ×öµ½ ......

²éѯoracleÊý¾Ý¿âʵÀýµÄÃû×Ö

dc-test2<oracle>sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Feb 25 22:44:25 2010
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
SQL> conn / as sysdba
Connected.
SQL> define
DEFINE _DATE           = ......

ORACLE ÈçºÎ²úÉúÒ»¸öËæ»úÊý

ORACLE ÈçºÎ²úÉúÒ»¸öËæ»úÊý:DBMS_RANDOM
--1¡¢Ð¡Êý( 0 ~ 1)
     select dbms_random.value from dual ;
--2¡¢Ö¸¶¨·¶Î§ÄÚµÄСÊý ( 0 ~ 100 )
     select dbms_random.value(0,100) from dual ;
--3¡¢Ö¸¶¨·¶Î§ÄÚµÄÕûÊý ( 0 ~ 100 )
     select trunc(d ......

OracleÖвéѯ±íµÄ´óСºÍ±í¿Õ¼äµÄ´óС

ÓÐÁ½ÖÖº¬ÒåµÄ±í´óС¡£Ò»ÖÖÊÇ·ÖÅä¸øÒ»¸ö±íµÄÎïÀí¿Õ¼äÊýÁ¿£¬¶ø²»¹Ü¿Õ¼äÊÇ·ñ±»Ê¹Ó᣿ÉÒÔÕâÑù²éѯ»ñµÃ×Ö½ÚÊý£º
select segment_name, bytes
from user_segments
where segment_type = 'TABLE';
»òÕß
   Select Segment_Name,Sum(bytes)/1024/1024 from User_Extents Group By Segment_Name
ÁíÒ»ÖÖ±íʵ¼ÊÊ¹Ó ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ