80179

Informix defining an INTERVAL with a parameter

I am doing the following in Informix to delete rows more than 20 seconds old.

delete from sometable where someDateColumn < (current - interval (20) second to second);

However, I want to make the interval configurable in a stored procedure, but I can't do

CREATE PROCEDURE i_hate_informix (prm_timeframe int) DELETE sometable WHERE someDateColumn < (current - interval (prm_timeframe) second to second); END PROCEDURE;

Answer1:

I found the answer myself.

Interval can not be defined dynamically with a variable. But you can use "units second" so my procedure becomes

CREATE PROCEDURE i_hate_informix (prm_timeframe int) DELETE sometable WHERE someDateColumn < (current - prm_timeframe units second); END PROCEDURE;

Recommend

  • Configuring mysql linked server with db2
  • Informix equivalent to mysql's SHOW CREATE TABLE
  • Lazy loading a portion of a record with NHibernate
  • Function Add Month in informix
  • MIME encoded folded Subject header results in warning when calling mail()
  • IBM Informix-SQL syntax error, basic query from Microsoft BIDS to Cisco UCCX database
  • php is compiled language or Interpreted language? [duplicate]
  • C# TimeZone Calculation Problem
  • Copying attributes in Javascript
  • Sort version strings on bash
  • How to have a website splash screen (web app)
  • MySql - get days remaining
  • data.table replicate rows after join?
  • INSERT EXEC Statement cannot be nested [duplicate]
  • Get used tables from sql query [duplicate]
  • Runtime.exec() gives Error: Could not find or load main class
  • User messaging system
  • pillow imaging ImportError
  • Low TTL with Leveled Compaction, should I reduce gc_grace_seconds to improve read performance withou
  • Button click event not firing in jQuery
  • Webgrid not refreshing after delete MVC
  • Converting a WriteableBitmap image ToArray in UWP
  • why overloaded new operator is calling constructor even I am using malloc inside overloading functio
  • Adding a button at the bottom of a table view
  • Is there any way to access browser form field suggestions from JavaScript?
  • Getting last autonumber in access
  • Hazelcast - OperationTimeoutException
  • Do I've to free mysql result after storing it?
  • Delete MySQLi record without showing the id in the URL
  • GridView Sorting works once only
  • Transpose CSV data with awk (pivot transformation)
  • PHP: When would you need the self:: keyword?
  • Acquiring multiple attributes from .xml file in c#
  • Change div Background jquery
  • Sorting a 2D array using the second column C++
  • reshape alternating columns in less time and using less memory
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?