Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Removal or ACSII Code

0 views
Skip to first unread message

Mike Gruntz

unread,
Dec 17, 1998, 3:00:00 AM12/17/98
to
Have a problem with users copy from Window apps and pasting into a
"note" field - VARCHAR2(2000). The problem is that ASCII codes such as
line feeds, tabs, etc are also copied and stored. When spooling to a
delimited text file or exporting data these ASCII codes (CODES 1-31
primarily) really can screw things up.

Is there an ORA Utility or Update/Insert Trigger that I'm not aware of
that I can use? If not any suggestions or sample code.

Thanks

Mike Gruntz
mgr...@ix.netcom.com


Andrew Protasov

unread,
Dec 18, 1998, 3:00:00 AM12/18/98
to
Hi,

You can use translate function to remove special characters:

SVRMGR> select 'a'||chr(10)||'b' from dual;
'A'
---
a
b
1 row selected.
SVRMGR> select translate('a'||chr(10)||'b',chr(10),' ') from dual;
TRA
---
a b
1 row selected.

Andrew Protasov

Arnold Schommer

unread,
Dec 21, 1998, 3:00:00 AM12/21/98
to
Mike Gruntz wrote:
>
> Have a problem with users copy from Window apps and pasting into a
> "note" field - VARCHAR2(2000). The problem is that ASCII codes such as
> line feeds, tabs, etc are also copied and stored. When spooling to a
> delimited text file or exporting data these ASCII codes (CODES 1-31
> primarily) really can screw things up.
>
> Is there an ORA Utility or Update/Insert Trigger that I'm not aware of
> that I can use? If not any suggestions or sample code.
>
> Thanks
>
> Mike Gruntz
> mgr...@ix.netcom.com

The translate function should do. Looks horrible, but ...
Try something like
SELECT TRANSLATE(note,
'x' || CHR(0) || CHR(1) || ... || CHR(31),
'x')
FROM your_table;
(the strange 'x' is required: if any of the arguments was empty, the
result would be empty)

Hope it helps.

Arnold Schommer

0 new messages