X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E3783D1BAEA for ; Thu, 8 Apr 2004 06:31:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 49384-05 for ; Thu, 8 Apr 2004 06:31:42 -0300 (ADT) Received: from chn-dns.primus-india.net (chn-dns.primus-india.net [203.196.153.7]) by svr1.postgresql.org (Postfix) with ESMTP id 5B454D1D096 for ; Thu, 8 Apr 2004 06:31:39 -0300 (ADT) Received: from ivesia67 (ptil-138-190-chn.primus-india.net [203.196.190.138] (may be forged)) by chn-dns.primus-india.net (8.12.8/8.12.8) with SMTP id i388VpJk000922 for ; Thu, 8 Apr 2004 14:01:54 +0530 Message-ID: <025001c41d4c$5db0bbc0$7502a8c0@hdsc.com> From: "kumar" To: "pgsql" Subject: Encoding and result string length Date: Thu, 8 Apr 2004 15:02:07 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_024D_01C41D7A.75FC4860" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/65 X-Sequence-Number: 17440 This is a multi-part message in MIME format. ------=_NextPart_000_024D_01C41D7A.75FC4860 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear Friends, Postgres 7.3.2 on Linux 8 I would like to fetch the datas from a table in a encoded format.=20 create table encodeco(c1 int4, c2 int4); insert into encodeco values(10000, 20000); select * from encodeco; So I want to encode the data while selecting. select encode(c1,'base64') from encodeco; ERROR: Function encode(integer, "unknown") does not exist Unable to identify a function that satisfies the given argument types You may need to add explicit typecasts So i tried select encode('c1','base64') from encodeco; =20=20=20=20 I got a result as 1 YzE=3D But this is the encoded value for 'c1' and not for the value 10000.=20 Please shed some light. Also is it possible to get the encoded values with only 2 charactors, irres= pective of the values of c1 ranging from 100 to 10 million Thanks Kumar ------=_NextPart_000_024D_01C41D7A.75FC4860 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear Friends,
 
Postgres 7.3.2 on Linux 8
 
I would like to fetch the datas from a tab= le in a=20 encoded format.
 
create table encodeco(c1 int4, c2 int4);insert=20 into encodeco values(10000, 20000);
select * from encodeco;
 
So I want to encode the data while=20 selecting.
select encode(c1,'base64') from=20 encodeco;

ERROR:  Function encode(integer, "unknown") does not=20 exist
 Unable to identify a function that satisfies the given argum= ent=20 types
 You may need to add explicit typecasts
 
So i  tried
    select encode('c1','bas= e64')=20 from encodeco;
   
I got a result as
    1   &nbs= p;=20 YzE=3D
 
But this is the encoded value for 'c1' and= not for=20 the value 10000.
 
Please shed some light.
 
Also is it possible to get the encoded val= ues with=20 only 2 charactors, irrespective of the values of c1 ranging from 100 to 10= =20 million
 
Thanks
Kumar
 
------=_NextPart_000_024D_01C41D7A.75FC4860--