------=_Part_4143_21146760.1207188761494
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hem... I think postgresql do not like that.
For this example in function spEAR470.
When "open Phasil for" not yet fini****ng, postgresql do "Delete from
ear470_02 where sessid = Psess;". And this function becoming ERROR.
But this case happen when this function call from 3 users in same time.
Any solution please?
Thanks before.
Create or Replace Function spEAR470 (refcursor,varchar,char,char,char)
returns refcursor
as '
declare
Phasil alias for $1; Psess alias for $2;
PTglFrom alias for $3; PTglTo alias for $4;
Psbmscd alias for $5;
jumlah integer;
waktu text;
begin
Select '' Begin - spEAR470 = '' || timeofday() into waktu;
Raise Notice ''%'',waktu;
Delete from ear470_01 where sessid = Psess;
Delete from ear470_02 where sessid = Psess;
/* Rekap data transaksi proses produksi untuk bulan dan mesin yang
bersangkutan */
insert into ear470_01(sessid,sbmscd,sbmsnm,wipcod,bjcod,
wasgrpnm,wastcd,wastds,
qtywaste,unit,qtywstbesar,qtywstkecil,qtykonv,
running,runbesar,runkecil,runkonv)
select PSess,B.sbmscd,D.SBMSNM,B.wipcod,'''',
coalesce(C.wasgrpnm,''''),coalesce(A.wastcd,''''),coalesce(C.wastds,''''),
sum(coalesce(A.qtywst,0)),E.brunin,0,0,sum(A.qtywst),
0,0,0,0
from B
left outer join A on B.jentrn=A.jentrn and B.thbltr=A.thbltr and
B.nortrn=A.nortrn
and A.brgcod in (''WST')
left outer join C on C.wastcd=A.wastcd
inner Join D On D.SBMSCD = B.SBMSCD
inner join E On B.wipcod = E.brgcod
where B.TGLTRN between PTglFrom and PTglTo and Trim(B.sbmscd) like
(PSbmscd)
and B.gdskcd = ''S'' and B.sbskcd <> ''P''
group by
B.sbmscd,B.wipcod,A.wastcd,C.wastds,E.brunin,D.SBMSNM,C.wasgrpnm;
Select '' spEAR470 - 9 = '' || timeofday() into waktu;
Raise Notice ''%'',waktu;
insert into
ear470_02(sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,qtywaste,unit,qtykonv,running,runkonv,activetime)
select
sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,sum(qtywaste),unit,sum(qtykonv),0,0,0
from ear470_01
where sessid = Psess
group by sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,unit;
Select '' spEAR470 - 10 = '' || timeofday() into waktu;
Raise Notice ''%'',waktu;
/* Put the result into hasil variable */
open Phasil for
select
SBMSCD,SBMSNM,WASGRPNM,WASTCD,WASTDS,Qtywaste,Unit,QtyKonv,Running,ActiveTime,RunKonv
from ear470_02
Where SESSID = PSess
Order By SBMSNM,WASGRPNM,WASTDS;
Select '' spEAR470 - 15 = '' || timeofday() into waktu;
Raise Notice ''%'',waktu;
/* Delete unused data */
Delete from ear470_01 where sessid = Psess;
Delete from ear470_02 where sessid = Psess;
Select '' End - spEAR470 = '' || timeofday() into waktu;
Raise Notice ''%'',waktu;
return Phasil;
end;
' language 'plpgsql';
On Thu, Apr 3, 2008 at 8:55 AM, paul rivers <rivers.paul@[EMAIL PROTECTED]
> wrote:
> Otniel Michael wrote:
>
> > Hi All..
> >
> > Anybody knows what is "GO" (SQL Server) on Postgres?
> >
> > Thanks.
> >
> > --
> > -------------------------------------------------------------------
> > "He who is quick to become angry will commit folly, and a crafty man
is
> > hated"
> >
>
> semi-colon.
>
>
>
--
-------------------------------------------------------------------
"He who is quick to become angry will commit folly, and a crafty man is
hated"
------=_Part_4143_21146760.1207188761494
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Hem... I think postgresql do not like that.<br>For this example in
function spEAR470.<br>When "open Phasil for" not yet fini****ng,
postgresql do "Delete from ear470_02 where sessid = Psess;". And
this function becoming ERROR.<br>
But this case happen when this function call from 3 users in same
time.<br>Any solution please?<br>Thanks before.<br><br>Create or Replace
Function spEAR470 (refcursor,varchar,char,char,char)<br>returns
refcursor<br>as '<br>
declare<br> Phasil alias for
$1; Psess alias for
$2;<br> PTglFrom alias for $3; PTglTo
alias for $4;<br> Psbmscd alias for
$5;<br><br> jumlah integer;<br><br>
waktu text;<br><br>begin<br><br>
Select '' Begin - spEAR470 = '' || timeofday() into
waktu; <br>Raise Notice
''%'',waktu;<br><br> Delete from
ear470_01 where sessid = Psess;<br> Delete from
ear470_02 where sessid = Psess;<br>
<br> /* Rekap data transaksi proses produksi untuk bulan
dan mesin yang bersangkutan */<br> insert into
ear470_01(sessid,sbmscd,sbmsnm,wipcod,bjcod,<br>
wasgrpnm,wastcd,wastds,<br>
qtywaste,unit,qtywstbesar,qtywstkecil,qtykonv,<br>
running,runbesar,runkecil,runkonv)<br> select
PSess,B.sbmscd,D.SBMSNM,B.wipcod,'''',<br>
coalesce(C.wasgrpnm,''''),coalesce(A.wastcd,''''),coalesce(C.wastds,''''),<br>
sum(coalesce(A.qtywst,0)),E.brunin,0,0,sum(A.qtywst),<br>
0,0,0,0<br> from
B<br> left outer join A on B.jentrn=A.jentrn and
B.thbltr=A.thbltr and B.nortrn=A.nortrn<br>
and A.brgcod in (''WST')<br>
left outer join C on
C.wastcd=A.wastcd<br> inner Join D On D.SBMSCD =
B.SBMSCD<br> inner join E On B.wipcod =
E.brgcod<br> where B.TGLTRN between PTglFrom and PTglTo
and Trim(B.sbmscd) like (PSbmscd)<br>
and B.gdskcd = ''S'' and B.sbskcd <>
''P''<br>
group by
B.sbmscd,B.wipcod,A.wastcd,C.wastds,E.brunin,D.SBMSNM,C.wasgrpnm;<br><br><br>Select
'' spEAR470 - 9 = '' || timeofday() into waktu;
<br>Raise Notice
''%'',waktu;<br><br>
insert into
ear470_02(sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,qtywaste,unit,qtykonv,running,runkonv,activetime)<br>
select
sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,sum(qtywaste),unit,sum(qtykonv),0,0,0<br>
from ear470_01<br>
where sessid = Psess<br> group by
sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,unit;<br><br>Select
'' spEAR470 - 10 = '' || timeofday() into waktu;
<br>Raise Notice
''%'',waktu;<br>
<br> /* Put the result into hasil variable
*/<br> open Phasil for<br> select
SBMSCD,SBMSNM,WASGRPNM,WASTCD,WASTDS,Qtywaste,Unit,QtyKonv,Running,ActiveTime,RunKonv<br>
from ear470_02<br> Where SESSID = PSess<br>
Order By SBMSNM,WASGRPNM,WASTDS;<br><br>Select
'' spEAR470 - 15 = '' || timeofday() into waktu;
<br>Raise Notice
''%'',waktu;<br><br> /* Delete unused data
*/<br> Delete from ear470_01 where sessid = Psess;<br>
Delete from ear470_02 where sessid = Psess;<br><br>Select
'' End - spEAR470 = '' || timeofday() into waktu;
<br>Raise Notice
''%'',waktu;<br><br> return
Phasil;<br>end;<br>' language 'plpgsql';<br>
<br><div class="gmail_quote">On Thu, Apr 3, 2008 at 8:55 AM, paul rivers
<<a href="mailto:rivers.paul@[EMAIL PROTECTED]
"
target="_blank">rivers.paul@[EMAIL PROTECTED]
>> wrote:<br><blockquote
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204);
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div>Otniel Michael wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
Hi All..<br>
<br>
Anybody knows what is "GO" (SQL Server) on Postgres?<br>
<br>
Thanks.<br>
<br>
-- <br>
-------------------------------------------------------------------<br>
"He who is quick to become angry will commit folly, and a crafty man
is hated" <br>
</blockquote>
<br></div></div>
semi-colon.<br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>--
<br>-------------------------------------------------------------------<br>"He
who is quick to become angry will commit folly, and a crafty man is
hated"
------=_Part_4143_21146760.1207188761494--


|