X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 81D8F32A3C4 for ; Wed, 13 Oct 2004 01:21:36 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75117-06 for ; Wed, 13 Oct 2004 00:21:29 +0000 (GMT) Received: from screen.dri.edu (screen.dri.edu [134.197.100.251]) by svr1.postgresql.org (Postfix) with ESMTP id 00E2632A301 for ; Wed, 13 Oct 2004 01:21:31 +0100 (BST) Received: (from fw_mx@localhost) by screen.dri.edu (8.9.1b+Sun/8.9.1) id RAA16713 for ; Tue, 12 Oct 2004 17:21:29 -0700 (PDT) Received: from derringer.dri.edu( 10.10.9.111) by screen.dri.edu via smap (V2.1.dri) id xma016342; Tue, 12 Oct 04 17:20:31 -0700 Received: from dri.edu (monlom.dri.edu [10.10.9.71]) by derringer.dri.edu (8.9.3+Sun/8.9.1) with ESMTP id RAA11403 for ; Tue, 12 Oct 2004 17:20:31 -0700 (PDT) Message-ID: <416C74CC.6030309@dri.edu> Date: Tue, 12 Oct 2004 17:20:28 -0700 From: Lori Organization: Desert Research Institute User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040219 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: help with to_date and to_char Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/126 X-Sequence-Number: 19229 Im trying to do something very simple I have a field called when_month (integer ) so I want to get the month name for the integer this comes close to what I want update mytable set myfield=to_char(current_timestamp,'MON'); the result is myfield is set to OCT which is close to what I want but when I try to use a variable update mytable set myfield=to_char(when_month,'MON'); or a char with value of '05' or '5' update mytable set myfield=to_char('05','MON'); get error: update mytable set myfield=to_date(when_month,'MON'); update mytable set myfield=to_char('05','MON'); as well as update mytable set full_month= to_date('01/'05'/2004','DDMONYYYY'); all get errors Please can anyone help?