Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D6482B5DBCC for ; Wed, 6 Jul 2011 16:38:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 95786-09 for ; Wed, 6 Jul 2011 19:38:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mbx.knossos.net.nz (mbx.knossos.net.nz [202.160.48.10]) by mail.postgresql.org (Postfix) with ESMTP id 6D049B5D944 for ; Wed, 6 Jul 2011 16:38:16 -0300 (ADT) Received: from [10.1.1.3] (60-234-150-59.bitstream.orcon.net.nz [60.234.150.59]) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id p66JcASh015581 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 7 Jul 2011 07:38:11 +1200 Message-ID: <4E14B9A2.7070907@archidevsys.co.nz> Date: Thu, 07 Jul 2011 07:38:10 +1200 From: Gavin Flower Organization: ArchiDevSys User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Thunderbird/3.1.10 MIME-Version: 1.0 To: John Fabiani CC: pgsql-sql@postgresql.org Subject: Re: interesting sequence (Correctin) References: <201107050652.22187.johnf@jfcomputer.com> <4E142F1A.8060900@archidevsys.co.nz> In-Reply-To: <4E142F1A.8060900@archidevsys.co.nz> Content-Type: multipart/alternative; boundary="------------030001050004070003070407" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201107/24 X-Sequence-Number: 35594 This is a multi-part message in MIME format. --------------030001050004070003070407 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 06/07/11 21:47, Gavin Flower wrote: I forgot the format required of the order number, so to get the full yesr, I should have used: to_char(day, 'YYYYMMDD') [...] > v_order_num := type::text || > '-' || > to_char(day, 'YYMMDD') || > '-' || > v_seq_new::text; [...] Cheers, Gavin --------------030001050004070003070407 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 06/07/11 21:47, Gavin Flower wrote:

I forgot the format required of the order number, so to get the full yesr, I should have used:
to_char(day, 'YYYYMMDD')

[...]
        v_order_num := type::text ||
                       '-' ||
                       to_char(day, 'YYMMDD') ||
                       '-' ||
                       v_seq_new::text;
[...]

Cheers,
Gavin --------------030001050004070003070407--