X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 537244763DC for ; Sat, 22 Mar 2003 11:26:08 -0500 (EST) Received: from motgate5.mot.com (motgate5.mot.com [144.189.100.105]) by postgresql.org (Postfix) with ESMTP id ECACB4763DA for ; Sat, 22 Mar 2003 11:26:04 -0500 (EST) Received: from pobox3.mot.com (pobox3.mot.com [10.64.251.242]) by motgate5.mot.com (Motorola/Motgate5) with ESMTP id h2MGPinp019123 for ; Sat, 22 Mar 2003 09:25:44 -0700 (MST) Received: [from plnt056.comm.mot.com (plnt056.comm.mot.com [145.2.198.83]) by pobox3.mot.com (MOT-pobox3 2.0) with ESMTP id JAA11964 for ; Sat, 22 Mar 2003 09:23:54 -0700 (MST)] Received: by plnt056.comm.mot.com with Internet Mail Service (5.5.2656.59) id ; Sat, 22 Mar 2003 11:26:08 -0500 Message-ID: From: Sethi Tarun-ETS017 To: "'Rajesh Kumar Mallah'" , Sethi Tarun-ETS017 , pgsql-sql@postgresql.org Subject: Re: newline character in SQL Date: Sat, 22 Mar 2003 11:26:07 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Status: No, hits=-12.5 required=5.0 tests=EMAIL_ATTRIBUTION,MSG_ID_ADDED_BY_MTA_3,ORIGINAL_MESSAGE, QUOTED_EMAIL_TEXT autolearn=ham version=2.50-cvs X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50-cvs (1.172-2003-02-14-exp) X-Archive-Number: 200303/532 X-Sequence-Number: 12571 Mallah, The "replace" didn't work. The lines still showup on multiple lines. I like to confirm if Oracle (I am using 8.0.6) recognizes the '\n'? Any other ideas from anyone? Appreciate the help. Regards, Tarun -----Original Message----- From: Rajesh Kumar Mallah [mailto:mallah@trade-india.com] Sent: Saturday, March 22, 2003 5:04 AM To: Sethi Tarun-ETS017; pgsql-sql@postgresql.org Subject: Re: [SQL] newline character in SQL Use replace function as documented in http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=functions-string.html eg in your case you can do: Select name, replace(name, '\n' , '') as straight_name , comments , replace(comments, '\n' , '') as straight_comment from table where comment like '%Fine%'; please not that replace function is inbuilt in postgresql 7.3.x , i previous versions i am not sure , but there is a work around for older versions. Regds Mallah. On Friday 21 Mar 2003 8:46 am, Sethi Tarun-ETS017 wrote: > How can I remove the newline character from the value of a column. > > For Example: > Select name, comments from table where comment like '%Fine%'; > Results: > NAME COMMENTS > John M. This was a > Fine piece of > work. > > Above, I'd like the Results to appear: > NAME COMMENTS > John M. This was a Fine piece of work. > > I tried substr, instr, hedged right ... but can't get it to work. > > Any help will be greatly appreciated. > > Regards > TS > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.