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

Home -> Community -> Usenet -> c.d.o.server -> Error : Using DBMS_ALERT

Error : Using DBMS_ALERT

From: Petit Donghwa <wonim.somaggio_at_lusis.fr>
Date: 29 Aug 2003 01:52:53 -0700
Message-ID: <ea4e9f9c.0308290052.42d6fab9@posting.google.com>


My goal is to notify automatically when ths table is inserted on my web_page written in PHP. (PHP and Oracle9) When I open this web_page it must run infinitely untile to to another web_page URL.
So I made this function with PL/SQL function to use DBMS_ALERT. I'm so poor for Oracle. so with many error occurs... --;;;;;; Could you help me Please what is a problem??


  1. table XYZ create table XYZ ( DATA1 integer; );
  2. Trigger for this table XYZ CREATE OR REPLACE TRIGGER XYZ_trig after insert on XYZ for each row begin dbms_alert.signal('xyz_alert', null); END XYZ; /
  3. crete function to signal to my PHP page to notify this table is changed. create or replace function change_xyz_f return number declare alert_msg varchar2(20); alert_status number := 0; begin DBMS_ALERT.REGISTER('xyz_insert'); DBMS_ALERT.WAITONE('xyz_insert', alert_msg, alert_status, 300);

if alert_status =1
then

        return 1;
else

        return 0;
end if;
DBMS_ALERT.REMOVE('xyz_insert');
end change_xyz_f;
/

4. on my web-page written in PHP
<?

$connection_oracle = OCILogon("xxxxx","xxxxxx");
$statement_oracle = OCIParse($connection_oracle, "BEGIN :s :=
change_xyz_f(); END;");

$statement_oracle = OCIParse($connection_oracle, $signal);

    OCIBindByName($statement_oracle, ":s", $s, 32);     OCIExecute($statement_oracle, OCI_DEFAULT);     OCIFreeStatement($statement_oracle);     OCILogOff($connection_oracle);

if ( $s == 1)
echo "Table is changed!";
else
echo "Table is Not changed!";

I make this PL/SQL function to use DBMS_ALERT. But many errors.
Could you help me??


  1. table XYZ create table XYZ ( DATA1 integer; );
  2. Trigger for this table XYZ CREATE OR REPLACE TRIGGER XYZ_trig after insert on XYZ for each row begin dbms_alert.signal('xyz_alert', null); END XYZ; /
  3. crete function to signal to my PHP page to notify this table is changed. create or replace function change_xyz_f return number declare alert_msg varchar2(20); alert_status number := 0; begin DBMS_ALERT.REGISTER('xyz_insert'); DBMS_ALERT.WAITONE('xyz_insert', alert_msg, alert_status, 300);

if alert_status =1
then

        return 1;
else

        return 0;
end if;
DBMS_ALERT.REMOVE('xyz_insert');
end change_xyz_f;
/

4. on my web-page written in PHP
<?

$connection_oracle = OCILogon("xxxxx","xxxxxx");
$statement_oracle = OCIParse($connection_oracle, "BEGIN :s :=
change_xyz_f(); END;");

$statement_oracle = OCIParse($connection_oracle, $signal);

    OCIBindByName($statement_oracle, ":s", $s, 32);     OCIExecute($statement_oracle, OCI_DEFAULT);     OCIFreeStatement($statement_oracle);     OCILogOff($connection_oracle);

if ( $s == 1)
echo "Table is changed!";
else
echo "Table is Not changed!";
?> Received on Fri Aug 29 2003 - 03:52:53 CDT

Original text of this message

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