pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Boettcher <bboett@erm1.u-strasbg.fr>
To: pgsql-sql@postgresql.org
Subject: Re: More stupid questions: prettyprinting of ints??
Date: Mon, 20 Nov 2000 16:08:26 +0100
Message-ID: <20001120160826.B25191@erm1.u-strasbg.fr> (raw)
In-Reply-To: <20001120154501.A25191@erm1.u-strasbg.fr>
References: <20001120154501.A25191@erm1.u-strasbg.fr>

yeah forgot another thing....
i want also to write a SQL trigger to parse incoming fields for
preprocessing before DB insertion....

in perl i would do a thing like that:

$format = "9999.999.999,99"; #took out of DB...
#inserting a number into the db....
$theval =~ s/\.//g;
if($theval =~/\S+,\d{2}/)
{
  $theval =~ s/,//g;
  $theval *= 100;
}
  
#extracting a number from the db....
$f= $#format;
$i= $#theval;
$res = "";
while($i>=0)
{
  if($format[$f] neq "9")
  {
    $res = $format[$f].$res  
    $f--;
  }#if($format[$f] neq "9")
  $res = $theval[$i].$res ; 
  $i--;
  $f--;
}#while($i>=0)

any chance i could this get out of the frontend into the DB? (as sayd
want to write more frontends so the less is in the frontend and the more
in the DB...)

-- 
ciao bboett
==============================================================
bboett@earthling.net
http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett
===============================================================
the total amount of intelligence on earth is constant.
human population is growing....



view thread (2+ messages)

Message-ID: <20001120160826.B25191@erm1.u-strasbg.fr>
Permalink:  ../20001120160826.B25191@erm1.u-strasbg.fr/
Also on:    postgresql.org/message-id/20001120160826.B25191@erm1.u-strasbg.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: bboett@erm1.u-strasbg.fr
  Subject: Re: More stupid questions: prettyprinting of ints??
  In-Reply-To: <20001120160826.B25191@erm1.u-strasbg.fr>
  References: <20001120154501.A25191@erm1.u-strasbg.fr> <20001120160826.B25191@erm1.u-strasbg.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox