Linuxmania
20th November 2011, 12:46 AM
gan nanya... ada yang tau ini kenapa?
Code:
create or replace procedure saldo_dep_mitra(
cust_id in customer.cust_id
)is
curr_deposit double precision;
gtu_deposit double precision;
vsetor double precision;
vambil double precision;
result sys_refcursor;
result2 sys_refcursor;
begin
/* Procedure SALDO_DEP_MITRA */
/* Hitung Saldo Berjalan dari tabel Penjualan */
select
sum(jml_setor)
into vsetor
from penjualan
where cust_id=cust_id;
select
sum(jml_ambil)
into vambil
from penjualan
where cust_id=cust_id;
dbms_output.put_line(vsetor||' , '||vambil);
end;
/
testernya ini...(itu yang biru kodenya sama kan??, tapi hasilnya kok beda)
Code:
select
sum(jml_setor)
from penjualan
where cust_id='AR1538';
select
sum(jml_ambil)
from penjualan
where cust_id='AR1538';
execute saldo_dep_mitra('AR1538');
outputannya:
SUM(JML_SETOR)
400000
SUM(JML_AMBIL)
105000
400000 , 95123200
PL/SQL procedure successfully completed.
itu kenapa yang merah beda??
:loveindonesia
</div>
Code:
create or replace procedure saldo_dep_mitra(
cust_id in customer.cust_id
)is
curr_deposit double precision;
gtu_deposit double precision;
vsetor double precision;
vambil double precision;
result sys_refcursor;
result2 sys_refcursor;
begin
/* Procedure SALDO_DEP_MITRA */
/* Hitung Saldo Berjalan dari tabel Penjualan */
select
sum(jml_setor)
into vsetor
from penjualan
where cust_id=cust_id;
select
sum(jml_ambil)
into vambil
from penjualan
where cust_id=cust_id;
dbms_output.put_line(vsetor||' , '||vambil);
end;
/
testernya ini...(itu yang biru kodenya sama kan??, tapi hasilnya kok beda)
Code:
select
sum(jml_setor)
from penjualan
where cust_id='AR1538';
select
sum(jml_ambil)
from penjualan
where cust_id='AR1538';
execute saldo_dep_mitra('AR1538');
outputannya:
SUM(JML_SETOR)
400000
SUM(JML_AMBIL)
105000
400000 , 95123200
PL/SQL procedure successfully completed.
itu kenapa yang merah beda??
:loveindonesia
</div>