<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Informix trigger statement in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/informix-trigger-statement/m-p/2591667#M853680</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I've only seen Triggers on insert used to cause an action on a different table; not update the same table as you want.&lt;BR /&gt;&lt;BR /&gt;If you are doing the insert through an ESQL programme, you  can add the logic for replacing nulls with your default value in the code before the insert.&lt;BR /&gt;Ditto for a shell script.&lt;BR /&gt;&lt;BR /&gt;I'm not sure why you want to use a trigger, but if you can live without it, you can do what you are trying to do with a Stored Procedure.&lt;BR /&gt;Create a stored procedure say myval2insert(fieldname). This prodeure will return "ABCDE" if fieldname is NULL, or else fieldname itself.&lt;BR /&gt;Your insert statement would then be "INSERT into table myval2insert(fieldname)..."&lt;BR /&gt;&lt;BR /&gt;Another option you may want to consider is to allow the database to hold NULLs, but while querying the table, do a &lt;BR /&gt;"SELECT nvl(field_name, \"ABCDE\") FROM table...".&lt;BR /&gt;This will return ABCDE if field_name is NULL.  &lt;BR /&gt;&lt;BR /&gt;For more info on triggers in Informix, see the SQL syntax guide for your Informix Engine at &lt;A href="http://www.informix.com/answers/" target="_blank"&gt;http://www.informix.com/answers/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Deepak.</description>
    <pubDate>Mon, 05 Nov 2001 03:52:44 GMT</pubDate>
    <dc:creator>Deepak Extross</dc:creator>
    <dc:date>2001-11-05T03:52:44Z</dc:date>
    <item>
      <title>Informix trigger statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/informix-trigger-statement/m-p/2591665#M853678</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Does anyone know the informix trigger statement ? I have the following example&lt;BR /&gt;&lt;BR /&gt;When inserting a table, if I encounter a field, say 'name', is a NULL value then the trigger statement should insert the table with the column a constant value "ABCDE" instead of NULL !&lt;BR /&gt;&lt;BR /&gt;My HP-UX is 11.0 and Informix 7.31.UC6A !&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Patrick</description>
      <pubDate>Tue, 09 Oct 2001 07:53:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/informix-trigger-statement/m-p/2591665#M853678</guid>
      <dc:creator>Patrick Chim</dc:creator>
      <dc:date>2001-10-09T07:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Informix trigger statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/informix-trigger-statement/m-p/2591666#M853679</link>
      <description>No, this is not my forte....but I did find an interesting page that gave some examples from an Informix Users Group that may help you.  Look past the intro...Here's the thread:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.iiug.org/~waiug/old/iugnew44.htm" target="_blank"&gt;http://www.iiug.org/~waiug/old/iugnew44.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rita</description>
      <pubDate>Wed, 10 Oct 2001 11:16:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/informix-trigger-statement/m-p/2591666#M853679</guid>
      <dc:creator>Rita C Workman</dc:creator>
      <dc:date>2001-10-10T11:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Informix trigger statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/informix-trigger-statement/m-p/2591667#M853680</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I've only seen Triggers on insert used to cause an action on a different table; not update the same table as you want.&lt;BR /&gt;&lt;BR /&gt;If you are doing the insert through an ESQL programme, you  can add the logic for replacing nulls with your default value in the code before the insert.&lt;BR /&gt;Ditto for a shell script.&lt;BR /&gt;&lt;BR /&gt;I'm not sure why you want to use a trigger, but if you can live without it, you can do what you are trying to do with a Stored Procedure.&lt;BR /&gt;Create a stored procedure say myval2insert(fieldname). This prodeure will return "ABCDE" if fieldname is NULL, or else fieldname itself.&lt;BR /&gt;Your insert statement would then be "INSERT into table myval2insert(fieldname)..."&lt;BR /&gt;&lt;BR /&gt;Another option you may want to consider is to allow the database to hold NULLs, but while querying the table, do a &lt;BR /&gt;"SELECT nvl(field_name, \"ABCDE\") FROM table...".&lt;BR /&gt;This will return ABCDE if field_name is NULL.  &lt;BR /&gt;&lt;BR /&gt;For more info on triggers in Informix, see the SQL syntax guide for your Informix Engine at &lt;A href="http://www.informix.com/answers/" target="_blank"&gt;http://www.informix.com/answers/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Deepak.</description>
      <pubDate>Mon, 05 Nov 2001 03:52:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/informix-trigger-statement/m-p/2591667#M853680</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2001-11-05T03:52:44Z</dc:date>
    </item>
  </channel>
</rss>

