Home » Developer & Programmer » Reports & Discoverer » After Report trigger
After Report trigger [message #301231] Tue, 19 February 2008 14:12 Go to next message
bernojai
Messages: 1
Registered: February 2008
Junior Member
Hi,

I am new here as well Oracle report...
The below trigger is not working... why ?
Please help me...

function AfterReport return boolean is
begin
srw.do_sql('update dss_tblstores set STORENAME1 =''INVALID1'' where STOREID=''000');
srw.do_sql('commit');
EXCEPTION
WHEN SRW.DO_SQL_FAILURE THEN
SRW.MESSAGE(100, 'ERROR WHILE CREATING CHECK TABLE.');
return (TRUE);
end;
Re: After Report trigger [message #301239 is a reply to message #301231] Tue, 19 February 2008 15:14 Go to previous message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps because the UPDATE statement is wrong?

It is a good idea to check whether you've done everything correctly by using the SQL*Plus session. Enable the serveroutput, put a string into a variable and show it on the screen - everything will be much more clear.

Here's an example:
SQL> DECLARE
  2    str VARCHAR2(200);
  3  BEGIN
  4    str := 'update dss_tblstores set STORENAME1 = ''INVALID1'' where STOREID = ''000';
  5    dbms_output.put_line('Wrong  : ' || str);
  6
  7    str := 'update dss_tblstores set STORENAME1 = ''INVALID1'' WHERE STOREID = ''000''';
  8    dbms_output.put_line('Correct: ' || str);
  9  END;
 10  /
Wrong  : update dss_tblstores set STORENAME1 = 'INVALID1' where STOREID = '000
Correct: update dss_tblstores set STORENAME1 = 'INVALID1' WHERE STOREID = '000'

PL/SQL procedure successfully completed.

SQL>
Note a missing single quote in the first string (the one you used).

Finally, your trigger might look like this:
BEGIN
  srw.do_sql('update test set STORENAME1 = ''INVALID1'' WHERE STOREID = ''000''');
  srw.do_sql('commit'); 
  RETURN (TRUE);
EXCEPTION 
  WHEN SRW.DO_SQL_FAILURE THEN 
  SRW.MESSAGE(100, 'ERROR WHILE CREATING CHECK TABLE.'); 
  RETURN (FALSE);
END;
Previous Topic: How to show current tiem in report
Next Topic: dis51usr.exe
Goto Forum:
  


Current Time: Thu Jul 04 18:52:55 CDT 2024