Trigger or stored procedure? 
Author Message
 Trigger or stored procedure?

Folks,

   We have loaded customers data from mainframe in EBCDIC to AIX DB2 V6.1.
   The data is in EBCDIC and our application works with it (we cannot convert
   it to ASCII). The problem I have is that in few of the (COBOL) programs
   they insert the data into the table(s) using CURRENT TIMESTAMP function.
   The problem is that the timestamp is inserted in ASCII. I can think of 2
   options to take care of it.

   1) Change all the timestamp columns to CHAR(26) and change the program
      to get the current timestamp, convert it to EBCDIC and insert it into
      the table ar character string.

   2) Create a trigger or stored procedure which is called automatically by
      DB2 whenever the timestamp column is inserted/updated. This
      trigger/stored procedure would take a ASCII TIMESTAMP and return the
      EBCDIC version, and the EBCDIC version would be inserted into the
      database.

    We are working on method 1. We had to do this few years ago. How can I do
    it using DB2 (method 2)?

    Thanks.

--
Hemant Shah                           /"\  ASCII ribbon campaign

                                       X     against HTML mail
TO REPLY, REMOVE NoJunkMail           / \      and postings      
FROM MY E-MAIL ADDRESS.          
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.



Mon, 16 Aug 2004 07:15:36 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Disable a trigger from within another trigger or stored procedure

2. Triggers and Stored Procedures

3. Creating install program for dB, tables, triggers, and stored procedures

4. Triggers and Stored Procedures

5. triggers vs stored procedures

6. Triggers and Store Procedures.

7. Trigger and Stored procedure help!!!

8. Trigger or Stored Procedure

9. Create a trigger in stored procedure???

10. CREATE TRIGGER in Stored Procedure?

11. Trigger a stored procedure on Table structure change

12. Defaults, Triggers and Stored Procedures


 
Powered by phpBB® Forum Software