Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> problem with oracle pl/sql

problem with oracle pl/sql

From: <m.kleinman_at_amyyon.nl>
Date: Thu, 28 May 1998 09:41:26 GMT
Message-ID: <6kjbg5$gi4$1@nnrp1.dejanews.com>


I've got a big problem with my stored pl/sql program on the oracle server.

Every time I use the procedure activity.saveactivity, it will save the data TWICE! set scan off;

create or replace package body Activity is

procedure startup (p_loginname in varchar2,p_identification in varchar2,p_langcodelabel in varchar2,p_langcodeedit in varchar2) as

   checkidentity char(6);
   cursor d_activity is select * from aiact;    d_count number := 0;
begin

   checkidentity :=
identification.checkidentity(p_loginname,p_identification);

   if checkidentity = 'not_ok' then

      login.startup(messages.label('LG_EXPIRED',p_langcodeedit));
      RETURN;
   Else
      layoutond.header('Activity');
      htp.p('<FONT
SIZE=+2>'||messages.label('AC_CAPT',p_langcodelabel)||'</FONT>');
      htp.para;

      for x in d_activity loop
          htp.p('<A

HREF="'||layoutond.INTERNET_URL||'activity.modact?p_loginname='||p_loginname||
'&p_identification='||p_identification||'&p_langcodelabel='||p_langcodelabel||
'&p_langcodeedit='||p_langcodeedit||'&p_seqnumber='||x.seqnumber||'">'||x.name
||'</A>');
          htp.nl;
          d_count := d_count + 1;
      end loop;
      htp.para;

      if d_count = 0 then
         htp.p(messages.label('AC_NOTFOUND',p_langcodelabel));
         htp.para;
      end if;
      htp.p('<A

HREF="'||layoutond.INTERNET_URL||'activity.addact?p_loginname='||p_loginname||
'&p_identification='||p_identification||'&p_langcodelabel='||p_langcodelabel||
'&p_langcodeedit='||p_langcodeedit||'">'||messages.label('ALG_ADD',p_langcodel
abel)||'</A>');

      layoutond.footer;
   end if;

exception

   when others then

      rollback;
      htp.p('error in activity.startup '||SQLERRM);

end;

procedure modact(p_loginname in varchar2,p_identification in varchar2,p_langcodelabel in varchar2,p_langcodeedit in varchar2,p_seqnumber in varchar2) as

   checkidentity char(6);
begin

   checkidentity :=
identification.checkidentity(p_loginname,p_identification);

   if checkidentity = 'not_ok' then

      login.startup(messages.label('LG_EXPIRED',p_langcodeedit));
      RETURN;
   Else
      layoutond.header('Activity');
      updatejavascript;
      deletejavascript;

      layoutond.footer;

   End If;

exception

   when others then

      rollback;
      htp.p('error in activity.modact '||SQLERRM);

end;

procedure addact(p_loginname in varchar2,p_identification in varchar2,p_langcodelabel in varchar2,p_langcodeedit in varchar2) as

   checkidentity char(6);
begin

   checkidentity :=
identification.checkidentity(p_loginname,p_identification);

   if checkidentity = 'not_ok' then

      login.startup(messages.label('LG_EXPIRED',p_langcodeedit));
      RETURN;
   Else
      layoutond.header('Activity');

      insertjavascript;

      htp.p('<FONT

SIZE=+2>'||messages.label('AC_CAPT',p_langcodelabel)||'</FONT>');

htp.formopen(layoutond.INTERNET_URL||'activity.saveact','GET','','','name="inp utform"');

      htp.formhidden('p_loginname',p_loginname);
      htp.formhidden('p_identification',p_identification);
      htp.formhidden('p_langcodelabel',p_langcodelabel);
      htp.formhidden('p_langcodeedit',p_langcodeedit);
      htp.TableOpen('0','null');
      htp.TableRowOpen;
      htp.TableData(messages.label('AC_NAME',p_langcodelabel));
      htp.TableData('<INPUT TYPE="text" NAME="p_name" SIZE="60"
MAXLENGTH="40">','','','','','2');
      htp.TableRowClose;
      htp.TableRowOpen;
      htp.TableData(messages.label('AC_SDATE',p_langcodelabel));
      htp.TableData('<INPUT TYPE="text" NAME="p_startdate" SIZE="10"
MAXLENGTH="10">','','','','','2');
      htp.TableRowClose;
      htp.TableRowOpen;
      htp.TableData(messages.label('AC_EDATE',p_langcodelabel));
      htp.TableData('<INPUT TYPE="text" NAME="p_enddate" SIZE="10"
MAXLENGTH="10">','','','','','2');
      htp.TableRowClose;
      htp.TableRowOpen;
      htp.TableData(messages.label('AC_SUBDATE',p_langcodelabel));
      htp.TableData('<INPUT TYPE="text" NAME="p_subdate" SIZE="10"
MAXLENGTH="10">','','','','','2');
      htp.TableRowClose;
      htp.TableRowOpen;
      htp.tableData(messages.label('AC_PUBLIC',p_langcodelabel));
      htp.p('<TD>');
      htp.p('<SELECT NAME = "p_public">');
      htp.p('<OPTION VALUE="Y">'||messages.label('ALG_YES',p_langcodelabel));
      htp.p('<OPTION VALUE="N">'||messages.label('ALG_NO',p_langcodelabel));
      htp.p('</SELECT>');
      htp.p('</TD>');
      htp.tablerowclose;
      htp.TableRowOpen;
      htp.p('<TD VALIGN="TOP">');
      htp.p(messages.label('AC_DESC',p_langcodelabel));
      htp.p('</TD>');
      htp.TableData('<textarea name="p_description" rows="10" cols="60"
wrap="virtual"></textarea>');
      htp.TableRowClose;
      htp.TableRowOpen;
      htp.TableData(messages.label('AC_ROUTEPIC',p_langcodelabel));
      htp.TableData('<INPUT TYPE="text" NAME="p_routepic" SIZE="60"
MAXLENGTH="40">','','','','','2');
      htp.TableRowClose;
      htp.TableRowOpen;
      htp.p('<TD VALIGN="TOP">');
      htp.p(messages.label('AC_ROUTE',p_langcodelabel));
      htp.p('</TD>');
      htp.TableData('<textarea name="p_route" rows="10" cols="60"
wrap="virtual"></textarea>');
      htp.TableRowClose;

      htp.tableRowOpen;
      htp.TableData(' ');
      htp.p('<TD>');
      htp.p('<INPUT type=button

value="'||messages.label('ALG_ACCEPT',p_langcodelabel)||'" onClick="test(this)">');
      htp.FormReset(messages.label('ALG_CLEAR',p_langcodelabel));
      htp.p('</TD>');
      htp.tableRowClose;
      htp.TableClose;
      htp.formclose;

      htmledit.show(p_langcodelabel,'inputform','p_description');

      layoutond.footer;

   End if;

exception

   when others then

      rollback;
      htp.p('error in activity.addact '||SQLERRM);
end ;

procedure saveact(p_loginname in varchar2,p_identification in

varchar2,p_langcodelabel in varchar2,p_langcodeedit in varchar2,p_name in
varchar2,p_startdate in varchar2,p_enddate in varchar2,p_subdate in
varchar2,p_public in varchar2,p_description in varchar2,p_routepic in
varchar2,p_route in varchar2) as

  d_actseq number;
  d_routeseq number;
begin

  select route_seq.nextval into d_routeseq from dual;

  insert into airoute (seqnumber,routetype,routepic,langcode,route) values (d_routeseq,'A',p_routepic,p_langcodeedit,p_route);   commit;
  select act_seq.nextval into d_actseq from dual;   insert into aiact
(seqnumber,name,startdate,enddate,subdate,aiact_public,description,routecode,l angcode) values
(d_actseq,p_name,to_date(p_startdate,'dd-mm-yyyy'),to_date(p_enddate,'dd-mm-yy yy'),to_date(p_subdate,'dd-mm-yyyy'),p_public,p_description,d_routeseq,p_langc odeedit);

  commit;

 startup(p_loginname,p_identification,p_langcodelabel,p_langcodeedit);

exception

   when others then

      rollback;
      htp.p('error in activity.saveact '||SQLERRM);

end;

procedure insertjavascript as
begin

htp.p('

<!-- Layout & Code by M.Kleinman -->
<script language="javascript">
<!--

function validate(ctl)
{
  if (document.inputform.p_name.value == "") {alert("activityname may not
be empty");document.inputform.p_name.focus();return false;}
  if (document.inputform.p_startdate.value == "" ||
document.inputform.p_startdate.value.indexOf ("-", 1) == -1 ||
document.inputform.p_startdate.value.length != 10)
   {
      alert("startdate is incorrect, must be dd-mm-yyyy");
      document.inputform.p_startdate.focus();
      return false;

   }
  if (document.inputform.p_enddate.value == "" ||
document.inputform.p_enddate.value.indexOf ("-", 1) == -1 ||
document.inputform.p_enddate.value.length != 10)
   {
      alert("enddate is incorrect, must be dd-mm-yyyy");
      document.inputform.p_enddate.focus();
      return false;

   }
  if (document.inputform.p_subdate.value == "" ||
document.inputform.p_subdate.value.indexOf ("-", 1) == -1 ||
document.inputform.p_subdate.value.length != 10)
   {
      alert("subdate is incorrect, must be dd-mm-yyyy");
      document.inputform.p_subdate.focus();
      return false;

   }
  if (document.inputform.p_description.value == "") {alert("description may not be empty");document.inputform.p_description.focus();return false;}   if (document.inputform.p_routepic.value == "") {alert("routepic may not be empty");document.inputform.p_routepic.focus();return false;}   if (document.inputform.p_route.value == "") {alert("route may not be empty");document.inputform.p_route.focus();return false;}   return true;
}

function test(ctl) {
  if (!validate(ctl)) {return false;}
   document.inputform.submit();
   return true;
}

//-->
</script>
');

end ;

procedure updatejavascript as
begin

htp.p('

<!-- Layout & Code by M.Kleinman -->
<script language="javascript">
<!--

function validate(ctl)
{
  if (document.inputform.p_picture.value == "") {alert("route may not be empty");document.inputform.p_picture.focus();return false;}   return true;
}

function test(ctl,action) {
  if (!validate(ctl)) {return false;}
  document.inputform.p_formaction.value = "update";   document.inputform.submit();
  return true;
}
//-->
</script>
');

end;

procedure deletejavascript as
begin

htp.p('

<!-- Layout & Code by M.Kleinman -->
<script language="javascript">
<!--

function delete(ctl) {
  document.inputform.p_formaction.value = "delete";   document.inputform.submit();
  return true;
}

//-->
</script>
');

end;

end;

/

show errors;

---

I've tried everything, removed the javascript, removed database. Even made a completely new package, but still it saves all data twice in the database, .

anyone knows the problem?

please respond via email

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Thu May 28 1998 - 04:41:26 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US