oracle不会自动将*变成所有字段的。应该是你存或取的时候那里出了问题。
我觉得你应该在数据入库后马上检查一下数据库里存的值是不是确实正确。SQL> insert into test3 (zyz1) values ('SELECT SUM(b.tonnum*b.unitprice),TO_CHAR(
a.startdate, ''yyyy-mm''), a.firstside, SUM(b.tonnum) FROM salepact a, salepacti
tem b GROUP BY TO_CHAR(a.startdate, ''yyyy-mm''), a.firstside ORDER BY TO_CHAR(a
.startdate, ''yyyy-mm''), a.firstside');1 row created.SQL> set serveroutput on
SQL> declare
2 v_str varchar2(1000);
3 i number;
4 j integer;
5 begin
6 select zyz1 into v_str from test3 where length(zyz1)>100;
7 j := length(v_str)/100;
8 for i in 1..j loop
9 dbms_output.put_line(substr(v_str,(i-1)*100+1,100));
10 end loop;
11 dbms_output.put_line(substr(v_str,j*100+1,100));
12 end;
13 /
SELECT SUM(b.tonnum*b.unitprice),TO_CHAR(a.startdate, 'yyyy-mm'), a.firstside,
SUM(b.tonnum) FROM sa
lepact a, salepactitem b GROUP BY TO_CHAR(a.startdate, 'yyyy-mm'), a.firstside
ORDER BY TO_CHAR(a.st
artdate, 'yyyy-mm'), a.firstsidePL/SQL procedure successfully completed.
我觉得你应该在数据入库后马上检查一下数据库里存的值是不是确实正确。SQL> insert into test3 (zyz1) values ('SELECT SUM(b.tonnum*b.unitprice),TO_CHAR(
a.startdate, ''yyyy-mm''), a.firstside, SUM(b.tonnum) FROM salepact a, salepacti
tem b GROUP BY TO_CHAR(a.startdate, ''yyyy-mm''), a.firstside ORDER BY TO_CHAR(a
.startdate, ''yyyy-mm''), a.firstside');1 row created.SQL> set serveroutput on
SQL> declare
2 v_str varchar2(1000);
3 i number;
4 j integer;
5 begin
6 select zyz1 into v_str from test3 where length(zyz1)>100;
7 j := length(v_str)/100;
8 for i in 1..j loop
9 dbms_output.put_line(substr(v_str,(i-1)*100+1,100));
10 end loop;
11 dbms_output.put_line(substr(v_str,j*100+1,100));
12 end;
13 /
SELECT SUM(b.tonnum*b.unitprice),TO_CHAR(a.startdate, 'yyyy-mm'), a.firstside,
SUM(b.tonnum) FROM sa
lepact a, salepactitem b GROUP BY TO_CHAR(a.startdate, 'yyyy-mm'), a.firstside
ORDER BY TO_CHAR(a.st
artdate, 'yyyy-mm'), a.firstsidePL/SQL procedure successfully completed.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货