2013年(350)
发布时间:2013-04-24 11:09:41
方法1:Select translate('254名字性别介绍','1234567890名字性别介绍’','1234567890') From dual方法2:看俺的java实现首先:create or replace and compile java source named stringutil asimport Java.io.*;import Java.sql.*;public class StringUtil{public static String filterStr2Num(Stri.........【阅读全文】
发布时间:2013-04-24 11:09:13
表aid,name,val1,aaa,302,aaa,403,aaa,604,bbb,405,bbb,606,bbb,80得到结果name,val1,val2,val3aaa,30,40,60bbb,40,60,80Oracle中:select Name,sum(decode(tmp.rn,1,val)) val1,sum(decode(tmp.rn,2,val)) val2,sum(decode(tmp.rn,3,val)) val3 from (Select a.*,row_number() over(Partition .........【阅读全文】
发布时间:2013-04-24 11:08:45
--方法1declarecursor tmp_cur(tmp_num NUMBER) IS select * from tables where part_num=tmpnum;beginfor emp_record in tmp_cur(123) loop..............end loop;end;--方法2declarebeginfor emp_record in (select * from tables where part_num=123) loop..............end loop;end;.........【阅读全文】
发布时间:2013-04-24 11:08:13
Declaretmp_char Varchar2(500) := 'aaa|bbb|ccc|ddd|';tmp_sql Varchar(500);tmp_str Varchar(50);len_end Number(10);len_begin Number(10) := 0; Begindbms_output.put_line('tmp_char:' || tmp_char);While instr(tmp_char,'|')>0Looplen_end := instr(tmp_char,'|') ;tmp_str := substr(tmp_char,0,len_e.........【阅读全文】
发布时间:2013-04-24 11:07:43
DeclareCursor mycur Is Select table_name From dba_All_Tables Where owner='dbUser';vtable Varchar(50);vsql Varchar(500);Beginfor emp_record in mycur Loopvtable := emp_record.table_name;vsql := 'Select * From '||vtable;--Execute IMMEDIATE vsql;dbms_output.put_line(vsql);End Loop;......【阅读全文】