Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Re: Asking GO o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 3386 of 3717
Post > Topic >>

Re: Asking GO on SQL SERVER

by otnieltera@[EMAIL PROTECTED] ("Otniel Michael") Apr 3, 2008 at 09:12 AM

------=_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 &quot;open Phasil for&quot; not yet fini****ng,
postgresql do &quot;Delete from ear470_02 where sessid = Psess;&quot;. 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 &#39;<br>

declare<br>&nbsp;&nbsp;&nbsp; Phasil&nbsp;&nbsp;&nbsp; alias for
$1;&nbsp;&nbsp;&nbsp; Psess&nbsp;&nbsp;&nbsp; alias for
$2;<br>&nbsp;&nbsp;&nbsp; PTglFrom&nbsp;&nbsp;&nbsp; alias for $3; PTglTo
alias for $4;<br>&nbsp;&nbsp;&nbsp; Psbmscd&nbsp;&nbsp;&nbsp; alias for
$5;<br><br>&nbsp;&nbsp;&nbsp; jumlah integer;<br><br>&nbsp;&nbsp;&nbsp;
waktu text;<br><br>begin<br><br>

Select &#39;&#39;&nbsp; Begin - spEAR470 = &#39;&#39; || timeofday() into
waktu; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>Raise Notice
&#39;&#39;%&#39;&#39;,waktu;<br><br>&nbsp;&nbsp;&nbsp; Delete from
ear470_01 where sessid = Psess;<br>&nbsp;&nbsp;&nbsp; Delete from
ear470_02 where sessid = Psess;<br>

<br>&nbsp;&nbsp;&nbsp; /* Rekap data transaksi proses produksi untuk bulan
dan mesin yang bersangkutan */<br>&nbsp;&nbsp;&nbsp; insert into
ear470_01(sessid,sbmscd,sbmsnm,wipcod,bjcod,<br>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; wasgrpnm,wastcd,wastds,<br>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; qtywaste,unit,qtywstbesar,qtywstkecil,qtykonv,<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
running,runbesar,runkecil,runkonv)<br>&nbsp;&nbsp;&nbsp; select
PSess,B.sbmscd,D.SBMSNM,B.wipcod,&#39;&#39;&#39;&#39;,<br>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
coalesce(C.wasgrpnm,&#39;&#39;&#39;&#39;),coalesce(A.wastcd,&#39;&#39;&#39;&#39;),coalesce(C.wastds,&#39;&#39;&#39;&#39;),<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
sum(coalesce(A.qtywst,0)),E.brunin,0,0,sum(A.qtywst),<br>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; 0,0,0,0<br>&nbsp;&nbsp;&nbsp; from
B<br>&nbsp;&nbsp;&nbsp; left outer join A on B.jentrn=A.jentrn and
B.thbltr=A.thbltr and B.nortrn=A.nortrn<br>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; and A.brgcod in (&#39;&#39;WST&#39;)<br>

&nbsp;&nbsp;&nbsp; left outer join C on
C.wastcd=A.wastcd<br>&nbsp;&nbsp;&nbsp; inner Join D On D.SBMSCD =
B.SBMSCD<br>&nbsp;&nbsp;&nbsp; inner join E On B.wipcod =
E.brgcod<br>&nbsp;&nbsp;&nbsp; where B.TGLTRN between PTglFrom and PTglTo
and Trim(B.sbmscd) like (PSbmscd)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
and B.gdskcd = &#39;&#39;S&#39;&#39; and B.sbskcd &lt;&gt;
&#39;&#39;P&#39;&#39;<br>

&nbsp;&nbsp;&nbsp; group by
B.sbmscd,B.wipcod,A.wastcd,C.wastds,E.brunin,D.SBMSNM,C.wasgrpnm;<br><br><br>Select
&#39;&#39;&nbsp; spEAR470 - 9 = &#39;&#39; || timeofday() into waktu;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>Raise Notice
&#39;&#39;%&#39;&#39;,waktu;<br><br>

&nbsp;&nbsp;&nbsp; insert into
ear470_02(sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,qtywaste,unit,qtykonv,running,runkonv,activetime)<br>&nbsp;&nbsp;&nbsp;
select
sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,sum(qtywaste),unit,sum(qtykonv),0,0,0<br>&nbsp;&nbsp;&nbsp;
from ear470_01<br>

&nbsp;&nbsp;&nbsp; where sessid = Psess<br>&nbsp;&nbsp;&nbsp; group by
sessid,sbmscd,sbmsnm,wasgrpnm,wastcd,wastds,unit;<br><br>Select
&#39;&#39;&nbsp; spEAR470 - 10 = &#39;&#39; || timeofday() into waktu;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>Raise Notice
&#39;&#39;%&#39;&#39;,waktu;<br>

<br>&nbsp;&nbsp; /* Put the result into hasil variable&nbsp;
*/<br>&nbsp;&nbsp; open Phasil for<br>&nbsp;&nbsp; select
SBMSCD,SBMSNM,WASGRPNM,WASTCD,WASTDS,Qtywaste,Unit,QtyKonv,Running,ActiveTime,RunKonv<br>&nbsp;&nbsp;
from ear470_02<br>&nbsp;&nbsp; Where SESSID = PSess<br>

&nbsp;&nbsp; Order By SBMSNM,WASGRPNM,WASTDS;<br><br>Select
&#39;&#39;&nbsp; spEAR470 - 15 = &#39;&#39; || timeofday() into waktu;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>Raise Notice
&#39;&#39;%&#39;&#39;,waktu;<br><br>&nbsp;&nbsp; /* Delete unused data
*/<br>&nbsp;&nbsp; Delete from ear470_01 where sessid = Psess;<br>

&nbsp;&nbsp; Delete from ear470_02 where sessid = Psess;<br><br>Select
&#39;&#39;&nbsp; End - spEAR470 = &#39;&#39; || timeofday() into waktu;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>Raise Notice
&#39;&#39;%&#39;&#39;,waktu;<br><br>&nbsp;&nbsp; return
Phasil;<br>end;<br>&#39; language &#39;plpgsql&#39;;<br>

<br><div class="gmail_quote">On Thu, Apr 3, 2008 at 8:55 AM, paul rivers
&lt;<a href="mailto:rivers.paul@[EMAIL PROTECTED]
"
target="_blank">rivers.paul@[EMAIL PROTECTED]
>&gt; 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 &quot;GO&quot; (SQL Server) on Postgres?<br>
<br>
Thanks.<br>
<br>
-- <br>
-------------------------------------------------------------------<br>
&quot;He who is quick to become angry will commit folly, and a crafty man
is hated&quot; <br>
</blockquote>
<br></div></div>
semi-colon.<br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>--
<br>-------------------------------------------------------------------<br>&quot;He
who is quick to become angry will commit folly, and a crafty man is
hated&quot;

------=_Part_4143_21146760.1207188761494--
 




 5 Posts in Topic:
Asking GO on SQL SERVER
otnieltera@[EMAIL PROTECT  2008-04-03 08:44:31 
Re: Asking GO on SQL SERVER
rivers.paul@[EMAIL PROTEC  2008-04-02 18:55:09 
Re: Asking GO on SQL SERVER
singh.gurjeet@[EMAIL PROT  2008-04-03 07:39:17 
Re: Asking GO on SQL SERVER
otnieltera@[EMAIL PROTECT  2008-04-03 09:12:41 
Re: Asking GO on SQL SERVER
phillip.smith@[EMAIL PROT  2008-04-03 14:06:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 4:06:58 CDT 2008.