RE: Sqlplus Masking?

From: <rzx2122_at_mcvax2.d48.lilly.com>
Date: 16 Apr 93 13:06:52 EST
Message-ID: <1993Apr16.130652.1_at_mcvax2.d48.lilly.com>


>From: pkane_at_diablo.cisco.com (Peter Kane), cisco Systems
>Date: 16 Apr 1993 15:21:25 GMT
>
>I need to create a view that masks a '=' off the end of a character
>string, but not all of the strings have the '='.
>
>For example, if I had:
>
>order_num part_num
>--------- --------
>S12345 ABC
>S87654 ABC=
>
>
>I need to mask off the '=' in the second record's part_num so I can
>get a sum for 'ABC' that would include the 'ABC=' part.
>
>Any ideas?

This worked:
  1 CREATE VIEW NOEQUALS AS
  2 SELECT ORDER_NUM,
  3 SUBSTR(PART_NUM,1,DECODE(INSTR(PART_NUM,'='),0,LENGTH(PART_NUM),

  4                      INSTR(PART_NUM,'=')-1))
  5         PART_NOEQUAL

  6* FROM X View created.

SQL> SELECT PART_NOEQUAL, COUNT(ORDER_NUM)   2 FROM NOEQUALS
  3 GROUP BY PART_NOEQUAL
  4 /

PART_NOE COUNT(ORDER_NUM)

-------- ----------------
ABC                     2

========================================================================
                                           ,-------+
Tom Harleman                               |       |
Steering Committee Member                  |       |
Paradigm Consulting, Inc.                  | INOUG |
11080 Willowmere Drive                     | Indiana Oracle Users Group
Indianapolis, IN  46280                    |       |
USA                                        |      _+
                                           /   _,'
Compuserve: 72072,2122                    /_,-'
========================================================================
Received on Fri Apr 16 1993 - 20:06:52 CEST

Original text of this message